implement channel playlist index overwrite

This commit is contained in:
simon 2022-03-16 12:32:42 +07:00
parent f0e82caebb
commit 1498fadf27
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
4 changed files with 23 additions and 1 deletions

View File

@ -47,6 +47,9 @@
},
"autodelete_days": {
"type": "long"
},
"index_playlists": {
"type": "boolean"
}
}
}
@ -120,6 +123,9 @@
},
"autodelete_days": {
"type": "long"
},
"index_playlists": {
"type": "boolean"
}
}
}

View File

@ -183,5 +183,14 @@ class SubscribeToPlaylistForm(forms.Form):
class ChannelOverwriteForm(forms.Form):
"""custom overwrites for channel settings"""
PLAYLIST_INDEX = [
("", "-- change playlist index --"),
("0", "Disable playlist index"),
("1", "Enable playlist index"),
]
download_format = forms.CharField(label=False, required=False)
autodelete_days = forms.IntegerField(label=False, required=False)
index_playlists = forms.ChoiceField(
widget=forms.Select, choices=PLAYLIST_INDEX, required=False
)

View File

@ -274,7 +274,7 @@ class YoutubeChannel(YouTubeItem):
def set_overwrites(self, overwrites):
"""set per channel overwrites"""
valid_keys = ["download_format", "autodelete_days"]
valid_keys = ["download_format", "autodelete_days", "index_playlists"]
to_write = self.json_data.get("channel_overwrites", {})
for key, value in overwrites.items():

View File

@ -75,6 +75,13 @@
False
{% endif %}</span></p>
{{ channel_overwrite_form.autodelete_days }}<br>
<p>Index playlists: <span class="settings-current">
{% if channel_info.channel_overwrites.index_playlists %}
{{ channel_info.channel_overwrites.index_playlists }}
{% else %}
False
{% endif %}</span></p>
{{ channel_overwrite_form.index_playlists }}<br>
<button type="submit">Save</button>
</form>
</div>