From 42a1033e7eeef1dd3e9a17cbda7ff60d5c971fc4 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 22 Dec 2024 02:42:30 -0500 Subject: [PATCH] Rename old_youtube_cache_dirs It makes sense to do this here because anyone who had the previous setting was, more than likely, using this file. --- tubesync/tubesync/local_settings.py.container | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tubesync/tubesync/local_settings.py.container b/tubesync/tubesync/local_settings.py.container index 84e29c5f..e75778b8 100644 --- a/tubesync/tubesync/local_settings.py.container +++ b/tubesync/tubesync/local_settings.py.container @@ -88,3 +88,13 @@ SOURCE_DOWNLOAD_DIRECTORY_PREFIX = True if SOURCE_DOWNLOAD_DIRECTORY_PREFIX_STR VIDEO_HEIGHT_CUTOFF = int(os.getenv("TUBESYNC_VIDEO_HEIGHT_CUTOFF", "240")) + + +# ensure that the current directory exists +if not YOUTUBE_DL_CACHEDIR.is_dir(): + YOUTUBE_DL_CACHEDIR.mkdir(parents=True) +# rename any old yt_dlp cache directories to the current directory +old_youtube_cache_dirs = list(YOUTUBE_DL_CACHEDIR.parent.glob('youtube-*')) +for cache_dir in old_youtube_cache_dirs: + cache_dir.rename(YOUTUBE_DL_CACHEDIR / cache_dir.name) +