handle empty channel migration cleanup

This commit is contained in:
Simon 2023-06-28 20:07:40 +07:00
parent 8a7cb8bc6f
commit 2a60360f4a
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -178,6 +178,9 @@ class ChannelMigration:
def delete_old(self, all_videos):
"""delete old folder path if empty"""
if not all_videos:
return
channel_name = os.path.split(all_videos[0]["media_url"])[0]
old_path = os.path.join(self.videos, channel_name)
if os.path.exists(old_path) and not os.listdir(old_path):