mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-24 20:50:14 +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 = [
|
SP_CHOICES = [
|
||||||
("", "-- change sponsorblock integrations"),
|
("", "-- change sponsorblock integrations"),
|
||||||
("0", "disable sponsorblock integration"),
|
("disable", "disable sponsorblock integration"),
|
||||||
("1", "enable sponsorblock integration"),
|
("1", "enable sponsorblock integration"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -351,6 +351,9 @@ class YoutubeChannel(YouTubeItem):
|
|||||||
for key, value in overwrites.items():
|
for key, value in overwrites.items():
|
||||||
if key not in valid_keys:
|
if key not in valid_keys:
|
||||||
raise ValueError(f"invalid overwrite key: {key}")
|
raise ValueError(f"invalid overwrite key: {key}")
|
||||||
|
if value == "disable":
|
||||||
|
to_write[key] = False
|
||||||
|
continue
|
||||||
if value in [0, "0"]:
|
if value in [0, "0"]:
|
||||||
del to_write[key]
|
del to_write[key]
|
||||||
continue
|
continue
|
||||||
|
@ -412,16 +412,18 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
|
|||||||
|
|
||||||
def _check_get_sb(self):
|
def _check_get_sb(self):
|
||||||
"""check if need to run sponsor block"""
|
"""check if need to run sponsor block"""
|
||||||
|
integrate = False
|
||||||
if self.config["downloads"]["integrate_sponsorblock"]:
|
if self.config["downloads"]["integrate_sponsorblock"]:
|
||||||
return True
|
integrate = True
|
||||||
try:
|
|
||||||
single_overwrite = self.video_overwrites[self.youtube_id]
|
|
||||||
_ = single_overwrite["integrate_sponsorblock"]
|
|
||||||
return True
|
|
||||||
except KeyError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
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):
|
def _process_youtube_meta(self):
|
||||||
"""extract relevant fields from youtube"""
|
"""extract relevant fields from youtube"""
|
||||||
|
Loading…
Reference in New Issue
Block a user