Use mkdir_p in models.py

This commit is contained in:
tcely 2024-12-19 16:36:15 -05:00 committed by GitHub
parent 80a7718a64
commit 02f1d08570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,7 +19,8 @@ from common.utils import clean_filename, clean_emoji
from .youtube import (get_media_info as get_youtube_media_info, from .youtube import (get_media_info as get_youtube_media_info,
download_media as download_youtube_media, download_media as download_youtube_media,
get_channel_image_info as get_youtube_channel_image_info) get_channel_image_info as get_youtube_channel_image_info)
from .utils import seconds_to_timestr, parse_media_format, write_text_file from .utils import (seconds_to_timestr, parse_media_format, write_text_file,
mkdir_p)
from .matching import (get_best_combined_format, get_best_audio_format, from .matching import (get_best_combined_format, get_best_audio_format,
get_best_video_format) get_best_video_format)
from .mediaservers import PlexMediaServer from .mediaservers import PlexMediaServer
@ -1530,8 +1531,7 @@ class Media(models.Model):
if old_video_path.exists() and not new_video_path.exists(): if old_video_path.exists() and not new_video_path.exists():
old_video_path = old_video_path.resolve(strict=True) old_video_path = old_video_path.resolve(strict=True)
# mkdir -p destination_dir mkdir_p(new_video_path.parent)
new_video_path.parent.mkdir(parents=True, exist_ok=True)
# build the glob to match other files # build the glob to match other files
stem = Path(old_video_path.stem) stem = Path(old_video_path.stem)