implement per channel sponsorblock

This commit is contained in:
simon 2022-04-08 17:17:39 +07:00
parent fe3e3cfacc
commit 365ebf53a5
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
4 changed files with 30 additions and 2 deletions

View File

@ -50,6 +50,9 @@
}, },
"index_playlists": { "index_playlists": {
"type": "boolean" "type": "boolean"
},
"integrate_sponsorblock": {
"type" : "boolean"
} }
} }
} }
@ -130,6 +133,9 @@
}, },
"index_playlists": { "index_playlists": {
"type": "boolean" "type": "boolean"
},
"integrate_sponsorblock": {
"type" : "boolean"
} }
} }
} }

View File

@ -198,8 +198,17 @@ class ChannelOverwriteForm(forms.Form):
("1", "Enable playlist index"), ("1", "Enable playlist index"),
] ]
SP_CHOICES = [
("", "-- change sponsorblock integrations"),
("0", "disable sponsorblock integration"),
("1", "enable sponsorblock integration"),
]
download_format = forms.CharField(label=False, required=False) download_format = forms.CharField(label=False, required=False)
autodelete_days = forms.IntegerField(label=False, required=False) autodelete_days = forms.IntegerField(label=False, required=False)
index_playlists = forms.ChoiceField( index_playlists = forms.ChoiceField(
widget=forms.Select, choices=PLAYLIST_INDEX, required=False widget=forms.Select, choices=PLAYLIST_INDEX, required=False
) )
integrate_sponsorblock = forms.ChoiceField(
widget=forms.Select, choices=SP_CHOICES, required=False
)

View File

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

View File

@ -89,7 +89,15 @@
{% endif %}</span></p> {% endif %}</span></p>
{{ channel_overwrite_form.index_playlists }}<br> {{ channel_overwrite_form.index_playlists }}<br>
</div> </div>
<div class="overwrite-form-item"></div> <div class="overwrite-form-item">
<p>Enable <a href="https://sponsor.ajay.app/" target="_blank">SponsorBlock</a>: <span class="settings-current">
{% if channel_info.channel_overwrites.integrate_sponsorblock %}
{{ channel_info.channel_overwrites.integrate_sponsorblock }}
{% else %}
False
{% endif %}</span></p>
{{ channel_overwrite_form.integrate_sponsorblock }}<br>
</div>
<button type="submit">Save Channel Overwrites</button> <button type="submit">Save Channel Overwrites</button>
</form> </form>
</div> </div>