cleaning up leftover code from old vesions

This commit is contained in:
simon 2021-10-03 19:33:58 +07:00
parent 5c2a8286d3
commit 7df4233224
7 changed files with 4 additions and 54 deletions

View File

@ -8,25 +8,6 @@ from home.src.helper import RedisArchivist
from home.src.index_management import index_check
def sync_redis_state():
"""make sure redis gets the config.json values"""
print("sync redis")
config_handler = ArchivistConfig()
config_handler.load_new_defaults()
config = config_handler.config
sort_order = config["archive"]["sort"]
redis_archivist = RedisArchivist()
redis_archivist.set_message("sort_order", sort_order, expire=False)
hide_watched = bool(int(config["archive"]["hide_watched"]))
redis_archivist.set_message("hide_watched", hide_watched, expire=False)
show_subed_only = bool(int(config["archive"]["show_subed_only"]))
redis_archivist.set_message(
"show_subed_only", show_subed_only, expire=False
)
filter_view = config["archive"]["filter_view"]
redis_archivist.set_message("filter_view", filter_view, expire=False)
def make_folders():
"""make needed cache folders here so docker doesn't mess it up"""
folders = ["download", "channels", "videos", "import", "backup"]
@ -58,5 +39,4 @@ class HomeConfig(AppConfig):
def ready(self):
release_lock()
index_check()
sync_redis_state()
make_folders()

View File

@ -1,9 +1,6 @@
{
"archive": {
"sort": "published",
"filter_view": "pending",
"hide_watched": false,
"show_subed_only": false,
"page_size": 12
},
"default_view": {

View File

@ -10,7 +10,7 @@
<a href="/channel/{{ channel_info.channel_id }}/"><img src="/cache/channels/{{ channel_info.channel_id }}_banner.jpg" alt="channel_banner"></a>
{% endif %}
</div>
<div class="info-box info-box-3 padding-box">
<div class="info-box info-box-3">
<div class="info-box-item">
<div class="round-img">
<a href="{% url 'channel_id' channel_info.channel_id %}">

View File

@ -19,33 +19,6 @@
</div>
<div class="settings-group">
<h2>Archive View</h2>
<div class="settings-item">
<p>Current default Sort: <span class="settings-current">{{ config.archive.sort }}</span></p>
<i>Change how the home view and channels view sorts by defaults.</i><br>
<select name="archive.sort" id="archive.sort"">
<option value="" disabled selected> -- change sort order -- </option>
<option value="published">date published</option>
<option value="downloaded">date downloaded</option>
</select>
</div>
<div class="settings-item">
<p>Current default hide watched: <span class="settings-current">{{ config.archive.hide_watched }}</span></p>
<i>Show or hide watched videos by default.</i><br>
<select name="archive.hide_watched" id="archive.hide_watched"">
<option value="" disabled selected> -- change visibility -- </option>
<option value="0">show watched</option>
<option value="1">hide watched</option>
</select>
</div>
<div class="settings-item">
<p>Current default show subscribed channels only: <span class="settings-current">{{ config.archive.show_subed_only }}</span></p>
<i>Show subscribed channels only by default.</i><br>
<select name="archive.show_subed_only" id="archive.show_subed_only"">
<option value="" disabled selected> -- change visibility -- </option>
<option value="0">show subscribed only</option>
<option value="1">hide not subscribed</option>
</select>
</div>
<div class="settings-item">
<p>Current page size: <span class="settings-current">{{ config.archive.page_size }}</span></p>
<i>Result of videos showing in archive page</i><br>

View File

@ -111,6 +111,8 @@ class HomeView(View):
colors = config_handler["application"]["colors"]
view_style = config_handler["default_view"]["home"]
sort_order = RedisArchivist().get_message("sort_order")
if not sort_order:
sort_order = "published"
hide_watched = RedisArchivist().get_message("hide_watched")
return colors, view_style, sort_order, hide_watched

View File

@ -473,6 +473,7 @@ button:hover {
.info-box {
display: grid;
grid-gap: 1rem;
margin: 1rem 0;
}
.info-box-3 {

View File

@ -43,7 +43,6 @@ function toggleCheckbox(checkbox) {
var payloadDict = {};
payloadDict[toggleId] = toggleVal;
var payload = JSON.stringify(payloadDict);
console.log(payload);
sendPost(payload);
setTimeout(function(){
var currPage = window.location.pathname;
@ -91,7 +90,6 @@ function downloadNow(button) {
function forgetIgnore(button) {
var youtube_id = button.getAttribute('data-id');
var payload = JSON.stringify({'forgetIgnore': youtube_id});
console.log(payload);
sendPost(payload);
document.getElementById("dl-" + youtube_id).remove();
}
@ -99,7 +97,6 @@ function forgetIgnore(button) {
function addSingle(button) {
var youtube_id = button.getAttribute('data-id');
var payload = JSON.stringify({'addSingle': youtube_id});
console.log(payload);
sendPost(payload);
document.getElementById("dl-" + youtube_id).remove();
setTimeout(function(){