diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 18bddc1..969d8cd 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -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, diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 720f8ae..d567f73 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -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():