delete metadata when a media item is reset, related to #226

This commit is contained in:
meeb 2022-03-28 19:13:30 +11:00
parent d0a214e21b
commit 0c347d523d
3 changed files with 4 additions and 3 deletions

View File

@ -96,7 +96,7 @@ def media_post_save(sender, instance, created, **kwargs):
# Triggered after media is saved # Triggered after media is saved
cap_changed = False cap_changed = False
can_download_changed = False can_download_changed = False
# Reset the skip flag if the download cap has changed if the media has not # Reset the skip flag if the download cap has changed if the media has not
# already been downloaded # already been downloaded
if not instance.downloaded: if not instance.downloaded:
max_cap_age = instance.source.download_cap_date max_cap_age = instance.source.download_cap_date

View File

@ -52,7 +52,7 @@ def map_task_to_instance(task):
Source: 'sync:source', Source: 'sync:source',
Media: 'sync:media-item', Media: 'sync:media-item',
} }
# Unpack # Unpack
task_func, task_args_str = task.task_name, task.task_params task_func, task_args_str = task.task_name, task.task_params
model = TASK_MAP.get(task_func, None) model = TASK_MAP.get(task_func, None)
if not model: if not model:

View File

@ -630,6 +630,7 @@ class MediaSkipView(FormView, SingleObjectMixin):
# If the media has an associated NFO file with it, also delete it # If the media has an associated NFO file with it, also delete it
delete_file(self.object.nfopath) delete_file(self.object.nfopath)
# Reset all download data # Reset all download data
self.object.metadata = None
self.object.downloaded = False self.object.downloaded = False
self.object.downloaded_audio_codec = None self.object.downloaded_audio_codec = None
self.object.downloaded_video_codec = None self.object.downloaded_video_codec = None
@ -1033,4 +1034,4 @@ class UpdateMediaServerView(FormView, SingleObjectMixin):
def get_success_url(self): def get_success_url(self):
url = reverse_lazy('sync:mediaserver', kwargs={'pk': self.object.pk}) url = reverse_lazy('sync:mediaserver', kwargs={'pk': self.object.pk})
return append_uri_params(url, {'message': 'updated'}) return append_uri_params(url, {'message': 'updated'})