mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-12-28 04:40:12 +00:00
fix per channel sb integration
This commit is contained in:
parent
39c4bd8883
commit
3007e02fe5
@ -200,7 +200,7 @@ class ChannelOverwriteForm(forms.Form):
|
||||
|
||||
SP_CHOICES = [
|
||||
("", "-- change sponsorblock integrations"),
|
||||
("0", "disable sponsorblock integration"),
|
||||
("disable", "disable sponsorblock integration"),
|
||||
("1", "enable sponsorblock integration"),
|
||||
]
|
||||
|
||||
|
@ -351,6 +351,9 @@ class YoutubeChannel(YouTubeItem):
|
||||
for key, value in overwrites.items():
|
||||
if key not in valid_keys:
|
||||
raise ValueError(f"invalid overwrite key: {key}")
|
||||
if value == "disable":
|
||||
to_write[key] = False
|
||||
continue
|
||||
if value in [0, "0"]:
|
||||
del to_write[key]
|
||||
continue
|
||||
|
@ -412,16 +412,18 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
|
||||
|
||||
def _check_get_sb(self):
|
||||
"""check if need to run sponsor block"""
|
||||
integrate = False
|
||||
if self.config["downloads"]["integrate_sponsorblock"]:
|
||||
return True
|
||||
try:
|
||||
single_overwrite = self.video_overwrites[self.youtube_id]
|
||||
_ = single_overwrite["integrate_sponsorblock"]
|
||||
return True
|
||||
except KeyError:
|
||||
return False
|
||||
integrate = True
|
||||
|
||||
return False
|
||||
if self.video_overwrites:
|
||||
single_overwrite = self.video_overwrites.get(self.youtube_id)
|
||||
if not single_overwrite:
|
||||
return integrate
|
||||
|
||||
integrate = single_overwrite.get("integrate_sponsorblock", False)
|
||||
|
||||
return integrate
|
||||
|
||||
def _process_youtube_meta(self):
|
||||
"""extract relevant fields from youtube"""
|
||||
|
Loading…
Reference in New Issue
Block a user