Using greedy regex match on source_id.

This commit is contained in:
Roland 2022-01-27 21:06:30 -07:00
parent 8b0196ede3
commit 30b235a04e
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 3 additions and 1 deletions

View file

@ -391,7 +391,7 @@ async def get_statistics():
return ret
NAME_PARSER = re.compile(r'(.*?)_((?:\d+?)|(?:NA))_(?:(.+?)_)?(.*)\.'
NAME_PARSER = re.compile(r'(.*?)_((?:\d+?)|(?:NA))_(?:(.+)_)?(.*)\.'
r'(jpg|webp|flv|mp4|part|info\.json|description|webm|..\.srt|..\.vtt)')

View file

@ -170,6 +170,8 @@ def test_validate_video_exception(test_session, simple_channel, video_factory):
('foo .mp4', (None, None, None, 'foo')),
('NA_20000303_vp91w5_Bob's Pancakes.mp4', (None, '20000303', 'vp91w5', 'Bob's Pancakes')),
('NA_NA_vp91w5_Bob's Pancakes.mp4', (None, None, 'vp91w5', 'Bob's Pancakes')),
('Learning Self-Reliance_20170529_p_MzsCFkUPU_Beekeeping 2017 Part 6 - Merging Hives.mp4',
('Learning Self-Reliance', '20170529', 'p_MzsCFkUPU', 'Beekeeping 2017 Part 6 - Merging Hives'))
])
def test_parse_video_file_name(file_name, expected):
"""