From 9a718af1c9b356e484f675d878e9d7f462ae23aa Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Fri, 26 Apr 2024 21:31:31 +0200 Subject: [PATCH] feat: consistent caching for bandcamp --- music_kraken/pages/bandcamp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/music_kraken/pages/bandcamp.py b/music_kraken/pages/bandcamp.py index 1088be0..90064db 100644 --- a/music_kraken/pages/bandcamp.py +++ b/music_kraken/pages/bandcamp.py @@ -136,7 +136,7 @@ class Bandcamp(Page): "full_page": True, "search_filter": filter_string, "search_text": search_query, - }) + }, name=f"search_{filter_string}_{search_query}") if r is None: return results @@ -224,7 +224,7 @@ class Bandcamp(Page): def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist: artist = Artist() - r = self.connection.get(_parse_artist_url(source.url)) + r = self.connection.get(_parse_artist_url(source.url), name=f"artist_{urlparse(source.url).scheme}_{urlparse(source.url).netloc}") if r is None: return artist @@ -271,7 +271,7 @@ class Bandcamp(Page): def fetch_album(self, source: Source, stop_at_level: int = 1) -> Album: album = Album() - r = self.connection.get(source.url) + r = self.connection.get(source.url, name=f"album_{urlparse(source.url).netloc.split('.')[0]}_{urlparse(source.url).path.replace('/', '').replace('album', '')}") if r is None: return album @@ -338,7 +338,7 @@ class Bandcamp(Page): return [] def fetch_song(self, source: Source, stop_at_level: int = 1) -> Song: - r = self.connection.get(source.url) + r = self.connection.get(source.url, name=f"song_{urlparse(source.url).netloc.split('.')[0]}_{urlparse(source.url).path.replace('/', '').replace('track', '')}") if r is None: return Song()