Skip to content

Commit

Permalink
fixxed custom url_constants (OrfiTeam#23)
Browse files Browse the repository at this point in the history
* fixxed custom url_constants

now correctly parses the url for module defined url_constants

* we gamin with the tuple now

real tuple gaming

* type_matching refined

* correctly check the list before appending to download
  • Loading branch information
R3AP3 authored Dec 29, 2022
1 parent d800d4c commit 2add4cc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions orpheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,13 @@ def main():
'artist': DownloadTypeEnum.artist
}

type_ = None
for i in url_constants.values():
type_ = i if re.findall(i.name, url.path) else type_
if not type_:
print('Invalid URL entered, quitting')
exit() # TODO: replace with InvalidInput
id_ = components[-1]

media_to_download[service_name].append(MediaIdentification(media_type=type_, media_id=id_))
type_matches = [media_type for url_check, media_type in url_constants.items() if url_check in components]

if not type_matches:
print(f'Invalid URL: "{link}"')
exit()

media_to_download[service_name].append(MediaIdentification(media_type=type_matches[-1], media_id=components[-1]))
else:
raise Exception(f'Invalid argument: "{link}"')

Expand Down

0 comments on commit 2add4cc

Please sign in to comment.