From 365ebf53a5709c200118d74e753cc00e1a81783b Mon Sep 17 00:00:00 2001
From: simon
Date: Fri, 8 Apr 2022 17:17:39 +0700
Subject: [PATCH] implement per channel sponsorblock
---
tubearchivist/home/src/es/index_mapping.json | 6 ++++++
tubearchivist/home/src/frontend/forms.py | 9 +++++++++
tubearchivist/home/src/index/channel.py | 7 ++++++-
tubearchivist/home/templates/home/channel_id.html | 10 +++++++++-
4 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/tubearchivist/home/src/es/index_mapping.json b/tubearchivist/home/src/es/index_mapping.json
index 0fddc11..9a0ee47 100644
--- a/tubearchivist/home/src/es/index_mapping.json
+++ b/tubearchivist/home/src/es/index_mapping.json
@@ -50,6 +50,9 @@
},
"index_playlists": {
"type": "boolean"
+ },
+ "integrate_sponsorblock": {
+ "type" : "boolean"
}
}
}
@@ -130,6 +133,9 @@
},
"index_playlists": {
"type": "boolean"
+ },
+ "integrate_sponsorblock": {
+ "type" : "boolean"
}
}
}
diff --git a/tubearchivist/home/src/frontend/forms.py b/tubearchivist/home/src/frontend/forms.py
index 53ef284..337a805 100644
--- a/tubearchivist/home/src/frontend/forms.py
+++ b/tubearchivist/home/src/frontend/forms.py
@@ -198,8 +198,17 @@ class ChannelOverwriteForm(forms.Form):
("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)
autodelete_days = forms.IntegerField(label=False, required=False)
index_playlists = forms.ChoiceField(
widget=forms.Select, choices=PLAYLIST_INDEX, required=False
)
+ integrate_sponsorblock = forms.ChoiceField(
+ widget=forms.Select, choices=SP_CHOICES, required=False
+ )
diff --git a/tubearchivist/home/src/index/channel.py b/tubearchivist/home/src/index/channel.py
index 953078d..75824d8 100644
--- a/tubearchivist/home/src/index/channel.py
+++ b/tubearchivist/home/src/index/channel.py
@@ -340,7 +340,12 @@ class YoutubeChannel(YouTubeItem):
def set_overwrites(self, 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", {})
for key, value in overwrites.items():
diff --git a/tubearchivist/home/templates/home/channel_id.html b/tubearchivist/home/templates/home/channel_id.html
index 80b090b..a30b4f5 100644
--- a/tubearchivist/home/templates/home/channel_id.html
+++ b/tubearchivist/home/templates/home/channel_id.html
@@ -89,7 +89,15 @@
{% endif %}
{{ channel_overwrite_form.index_playlists }}
-
+