Added a regex filter string to sources and performs a regex skip if the filter string is not matched in the video title
This commit is contained in:
parent
42b337c408
commit
92559d1ae9
|
@ -287,6 +287,11 @@ class Source(models.Model):
|
||||||
help_text=_('If "delete old media" is ticked, the number of days after which '
|
help_text=_('If "delete old media" is ticked, the number of days after which '
|
||||||
'to automatically delete media')
|
'to automatically delete media')
|
||||||
)
|
)
|
||||||
|
filterText = models.CharField(
|
||||||
|
_('filter string'),
|
||||||
|
default='',
|
||||||
|
help_text=_('Regex compatible filter string for video titles')
|
||||||
|
)
|
||||||
source_resolution = models.CharField(
|
source_resolution = models.CharField(
|
||||||
_('source resolution'),
|
_('source resolution'),
|
||||||
max_length=8,
|
max_length=8,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import os
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import uuid
|
import uuid
|
||||||
|
import re
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
from datetime import timedelta, datetime
|
from datetime import timedelta, datetime
|
||||||
|
@ -255,6 +256,10 @@ def download_media_metadata(media_id):
|
||||||
log.warn(f'Media: {source} / {media} is older than '
|
log.warn(f'Media: {source} / {media} is older than '
|
||||||
f'{source.days_to_keep} days, skipping')
|
f'{source.days_to_keep} days, skipping')
|
||||||
media.skip = True
|
media.skip = True
|
||||||
|
|
||||||
|
if not re.search(filterText,media.title):
|
||||||
|
#filter text not found in the media title. Accepts regex string
|
||||||
|
media.skip = True
|
||||||
# Check we can download the media item
|
# Check we can download the media item
|
||||||
if not media.skip:
|
if not media.skip:
|
||||||
if media.get_format_str():
|
if media.get_format_str():
|
||||||
|
|
Loading…
Reference in New Issue