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:
locke4 2023-10-20 17:32:16 +01:00 committed by GitHub
parent 42b337c408
commit 92559d1ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -287,6 +287,11 @@ class Source(models.Model):
help_text=_('If "delete old media" is ticked, the number of days after which '
'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'),
max_length=8,

View File

@ -8,6 +8,7 @@ import os
import json
import math
import uuid
import re
from io import BytesIO
from hashlib import sha1
from datetime import timedelta, datetime
@ -255,6 +256,10 @@ def download_media_metadata(media_id):
log.warn(f'Media: {source} / {media} is older than '
f'{source.days_to_keep} days, skipping')
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
if not media.skip:
if media.get_format_str():