diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py
index 47225dd4..c115fbc1 100644
--- a/tubearchivist/home/src/download/queue.py
+++ b/tubearchivist/home/src/download/queue.py
@@ -269,9 +269,12 @@ class PendingList(PendingIndex):
"vid_thumb_url": vid["thumbnail"],
"title": vid["title"],
"channel_id": vid["channel_id"],
- "channel_indexed": vid["channel_id"] in self.all_channels,
"duration": duration_str,
"published": published,
"timestamp": int(datetime.now().strftime("%s")),
}
+ if self.all_channels:
+ youtube_details.update(
+ {"channel_indexed": vid["channel_id"] in self.all_channels}
+ )
return youtube_details
diff --git a/tubearchivist/home/src/download/yt_dlp_base.py b/tubearchivist/home/src/download/yt_dlp_base.py
index b32d536f..260b955b 100644
--- a/tubearchivist/home/src/download/yt_dlp_base.py
+++ b/tubearchivist/home/src/download/yt_dlp_base.py
@@ -30,7 +30,8 @@ class YtWrap:
"""build yt-dlp obs"""
self.obs = self.OBS_BASE.copy()
self.obs.update(self.obs_request)
- self.add_cookie()
+ if self.config:
+ self.add_cookie()
def add_cookie(self):
"""add cookie if enabled"""
diff --git a/tubearchivist/home/src/index/reindex.py b/tubearchivist/home/src/index/reindex.py
index 5fbdeee6..5e85f95c 100644
--- a/tubearchivist/home/src/index/reindex.py
+++ b/tubearchivist/home/src/index/reindex.py
@@ -153,6 +153,7 @@ class Reindex:
date_downloaded = video.json_data["date_downloaded"]
channel_dict = video.json_data["channel"]
playlist = video.json_data.get("playlist")
+ subtitles = video.json_data.get("subtitles")
# get new
video.build_json()
@@ -160,7 +161,7 @@ class Reindex:
video.deactivate()
return
- video.delete_subtitles()
+ video.delete_subtitles(subtitles=subtitles)
video.check_subtitles()
# add back
diff --git a/tubearchivist/home/src/index/video.py b/tubearchivist/home/src/index/video.py
index fa2b0f96..86d44a04 100644
--- a/tubearchivist/home/src/index/video.py
+++ b/tubearchivist/home/src/index/video.py
@@ -67,7 +67,7 @@ class YoutubeSubtitle:
return False
video_media_url = self.video.json_data["media_url"]
- media_url = video_media_url.replace(".mp4", f"-{lang}.vtt")
+ media_url = video_media_url.replace(".mp4", f".{lang}.vtt")
all_formats = all_subtitles.get(lang)
if not all_formats:
return False
@@ -103,7 +103,7 @@ class YoutubeSubtitle:
return False
video_media_url = self.video.json_data["media_url"]
- media_url = video_media_url.replace(".mp4", f"-{lang}.vtt")
+ media_url = video_media_url.replace(".mp4", f".{lang}.vtt")
all_formats = all_subtitles.get(lang)
if not all_formats:
# no user subtitles found
@@ -152,15 +152,19 @@ class YoutubeSubtitle:
"""send subtitle to es for indexing"""
_, _ = ElasticWrap("_bulk").post(data=query_str, ndjson=True)
- def delete(self):
+ def delete(self, subtitles=False):
"""delete subtitles from index and filesystem"""
youtube_id = self.video.youtube_id
- # delete files
videos_base = self.video.config["application"]["videos"]
- if not self.video.json_data.get("subtitles"):
- return
+ # delete files
+ if subtitles:
+ files = [i["media_url"] for i in subtitles]
+ else:
+ if not self.video.json_data.get("subtitles"):
+ return
+
+ files = [i["media_url"] for i in self.video.json_data["subtitles"]]
- files = [i["media_url"] for i in self.video.json_data["subtitles"]]
for file_name in files:
file_path = os.path.join(videos_base, file_name)
try:
@@ -594,10 +598,10 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
)
playlist.upload_to_es()
- def delete_subtitles(self):
+ def delete_subtitles(self, subtitles=False):
"""delete indexed subtitles"""
print(f"{self.youtube_id}: delete subtitles")
- YoutubeSubtitle(self).delete()
+ YoutubeSubtitle(self).delete(subtitles=subtitles)
def _get_ryd_stats(self):
"""get optional stats from returnyoutubedislikeapi.com"""
diff --git a/tubearchivist/home/templates/home/channel_id.html b/tubearchivist/home/templates/home/channel_id.html
index 04a43336..5aefcba8 100644
--- a/tubearchivist/home/templates/home/channel_id.html
+++ b/tubearchivist/home/templates/home/channel_id.html
@@ -145,9 +145,12 @@
{% if view_style == "grid" %}