Support for user playlists
This commit is contained in:
parent
ac277c28a0
commit
8c568ff5c7
1 changed files with 6 additions and 5 deletions
11
showtify.py
11
showtify.py
|
@ -143,15 +143,16 @@ def album_title(page_content):
|
|||
|
||||
|
||||
METADATA_CLASS_FOR_URL = [
|
||||
("https://open.spotify.com/track/", TrackMetadata),
|
||||
("https://open.spotify.com/album/", AlbumMetadata),
|
||||
("https://open.spotify.com/playlist/", AlbumMetadata)
|
||||
(r"https://open.spotify.com/track/.*", TrackMetadata),
|
||||
(r"https://open.spotify.com/album/.*", AlbumMetadata),
|
||||
(r"https://open.spotify.com/playlist/.*", AlbumMetadata),
|
||||
(r"https://open.spotify.com/user/.*/playlist/.*", AlbumMetadata),
|
||||
]
|
||||
|
||||
|
||||
def metadata_for_url(url):
|
||||
for url_start, cls in METADATA_CLASS_FOR_URL:
|
||||
if url.startswith(url_start):
|
||||
for url_regex, cls in METADATA_CLASS_FOR_URL:
|
||||
if re.fullmatch(url_regex, url):
|
||||
return cls.from_url(url)
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in a new issue