Update signals.py

This commit is contained in:
locke4 2023-11-28 08:48:31 +00:00
parent 33b471175a
commit 2d6f485a5d
1 changed files with 3 additions and 3 deletions

View File

@ -114,7 +114,7 @@ def media_post_save(sender, instance, created, **kwargs):
f'set but is already marked to be skipped') f'set but is already marked to be skipped')
else: else:
if max_cap_age and filter_text: if max_cap_age and filter_text:
if (published > max_cap_age) and (source.is_regex_match(instance.title)): if (published > max_cap_age) and (instance.source.is_regex_match(instance.title)):
# Media was published after the cap date and matches the filter text, but is set to be skipped # Media was published after the cap date and matches the filter text, but is set to be skipped
print('Has a valid publishing date and matches filter, marking unskipped') print('Has a valid publishing date and matches filter, marking unskipped')
instance.skip = False instance.skip = False
@ -131,7 +131,7 @@ def media_post_save(sender, instance, created, **kwargs):
instance.skip = False instance.skip = False
cap_changed = True cap_changed = True
elif filter_text: elif filter_text:
if source.is_regex_match(instance.title): if instance.source.is_regex_match(instance.title):
# Media matches the filter text but is set to be skipped # Media matches the filter text but is set to be skipped
log.info(f'Media: {instance.source} / {instance} matches the filter text, marking to be unskipped') log.info(f'Media: {instance.source} / {instance} matches the filter text, marking to be unskipped')
instance.skip = False instance.skip = False
@ -149,7 +149,7 @@ def media_post_save(sender, instance, created, **kwargs):
instance.skip = True instance.skip = True
cap_changed = True cap_changed = True
if filter_text: if filter_text:
if not re.search(filter_text,instance.title): if not instance.source.is_regex_match(instance.title):
#media doesn't match the filter text but is not marked to be skipped #media doesn't match the filter text but is not marked to be skipped
log.info(f'Media: {instance.source} / {instance} does not match the filter text') log.info(f'Media: {instance.source} / {instance} does not match the filter text')
instance.skip = True instance.skip = True