-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random source ids of 'youtube' #175
Comments
#175 #172 (comment) source name is optional for youtube playlist and channels as already super long youtube id can be in subfolder (series folder inside grouping folder)
source name optional for youtube playlist and channels
|
Well, I guess that explains where this line came from in the log for the series folder "Owarimonogatari (2017) [Dmon] [BD, 720p]":
Didn't seem to cause any harm, but it did seem rather odd - completely forgot that ASS is used by ZeroQI's YouTube-Agent too. |
Hey @ZeroQI, This should be easily simplified by a single regex. ...
SOURCE_IDS = '\[((?P<source>(anidb(|2)|tvdb(|[2-5])|tmdb|tsdb|imdb|youtube(|2)))-(?P<id>[^\[\]]*)|(?P<yt>(PL[^\[\]]{16}|UC[^\[\]]{22})))\]'
...
match = re.search(SOURCE_IDS, folder_show, re.IGNORECASE)
if not match and len(reverse_path)>1:
match = re.search(SOURCE_IDS, reverse_path[1], re.IGNORECASE)
if match: Log.info("Forced ID sourced from series folder")
if match:
if match.groupdict().has_key('yt') and match.group('yt'):
source, id = 'youtube', match.group('yt')
else:
id = match.group('id' ) if match.groupdict().has_key('id' ) and match.group('id' ) else ''
source = match.group('source') if match.groupdict().has_key('source') and match.group('source') else ''
Log.info("Forced ID: '{}' with id '{}'".format(source, id))
else:
for file in SOURCE_ID_FILES:
... EX: >>> SOURCE_IDS = '\[((?P<source>(anidb(|2)|tvdb(|[2-5])|tmdb|tsdb|imdb|youtube(|2)))-(?P<id>[^\[\]]*)|(?P<yt>(PL[^\[\]]{16}|UC[^\[\]]{22})))\]'
>>> qwe = 'asd [qwe] [anidb-123]' #Will properly ignore '[qwe]'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': 'anidb', 'yt': None, 'id': '123'}
>>> qwe = 'zxcasd [PL1234567890123456]'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': None, 'yt': 'PL1234567890123456', 'id': None}
>>> qwe = 'zxcasd [anidb-123] [PL1234567890123456]'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': 'anidb', 'yt': None, 'id': '123'}
>>> qwe = 'zxcasd [PL1234567890123456] [anidb-123]'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': None, 'yt': 'PL1234567890123456', 'id': None}
>>> qwe = 'zxcasd [PL12345678901234567890] [anidb-123]' #To many numbers after 'PL'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': 'anidb', 'yt': None, 'id': '123'}
>>> qwe = 'asd [youtube-654321]'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': 'youtube', 'yt': None, 'id': '654321'}
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': 'youtube2', 'yt': None, 'id': '654321'}
>>> qwe = 'asd [tvdb3-321]'
>>> re.search(SOURCE_IDS, qwe, re.IGNORECASE).groupdict()
{'source': 'tvdb3', 'yt': None, 'id': '321'} (Edit: Condensed the predefined 'SOURCE_IDS' ids) |
@EndOfLine369 Condensed 'SOURCE_IDS' is indeed clearer and shorter. |
Indeed even looks more cleaner 😄 Team effort. |
Hey @ZeroQI
Seems to be random listings of 'youtube' being listed as a found forced id.
What is the reasoning behind the 'source' name being optional now?
The vagueness of this id name requirement will also potentially cause mismatches.
There is even a secondary test where you have a blank case for source.
(|youtube)
You also have a test of
if source or id
that for what I can tell will never be set before this test.Shouldn't it be something like the below?
The text was updated successfully, but these errors were encountered: