Support for user playlists

This commit is contained in:
Midgard 2020-12-22 16:27:24 +01:00
parent ac277c28a0
commit 8c568ff5c7
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -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