Rewrite the .nfo file when the thumb path changed

This commit is contained in:
tcely 2024-12-18 01:08:14 -05:00 committed by GitHub
parent 278a92b7e1
commit 8f0825b57f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,7 +19,7 @@ from common.utils import clean_filename, clean_emoji
from .youtube import (get_media_info as get_youtube_media_info,
download_media as download_youtube_media,
get_channel_image_info as get_youtube_channel_image_info)
from .utils import seconds_to_timestr, parse_media_format
from .utils import seconds_to_timestr, parse_media_format, write_text_file
from .matching import (get_best_combined_format, get_best_audio_format,
get_best_video_format)
from .mediaservers import PlexMediaServer
@ -1548,6 +1548,12 @@ class Media(models.Model):
self.media_file.name = str(new_video_path.relative_to(media_file_storage.location))
self.save(update_fields={'media_file'})
# The thumbpath inside the .nfo file may have changed
if self.source.write_nfo and self.source.copy_thumbnails:
nfo_path_tmp = Path(str(self.nfopath) + '.tmp')
write_text_file(nfo_path_tmp, self.nfoxml)
nfo_path_tmp.replace(self.nfopath)
class MediaServer(models.Model):
'''