mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
handle deleting channel without videos
This commit is contained in:
parent
164ee5c523
commit
283a72308e
@ -227,11 +227,15 @@ class YoutubeChannel:
|
|||||||
print(f"deleting {self.channel_id} and all matching media files")
|
print(f"deleting {self.channel_id} and all matching media files")
|
||||||
folder_path = self.get_folder_path()
|
folder_path = self.get_folder_path()
|
||||||
print("delete all media files")
|
print("delete all media files")
|
||||||
all_videos = os.listdir(folder_path)
|
try:
|
||||||
for video in all_videos:
|
all_videos = os.listdir(folder_path)
|
||||||
video_path = os.path.join(folder_path, video)
|
for video in all_videos:
|
||||||
os.remove(video_path)
|
video_path = os.path.join(folder_path, video)
|
||||||
os.rmdir(folder_path)
|
os.remove(video_path)
|
||||||
|
os.rmdir(folder_path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"no videos found for {folder_path}")
|
||||||
|
|
||||||
ThumbManager().delete_chan_thumb(self.channel_id)
|
ThumbManager().delete_chan_thumb(self.channel_id)
|
||||||
|
|
||||||
print("delete indexed videos")
|
print("delete indexed videos")
|
||||||
|
Loading…
Reference in New Issue
Block a user