fixed disgusting bug
This commit is contained in:
@@ -20,20 +20,11 @@ from ..objects import (
|
||||
)
|
||||
|
||||
|
||||
class PageCache(Collection):
|
||||
def clear(self):
|
||||
self.__init__(element_type=self.element_type)
|
||||
|
||||
|
||||
class Page:
|
||||
"""
|
||||
This is an abstract class, laying out the
|
||||
functionality for every other class fetching something
|
||||
"""
|
||||
SONG_CACHE = PageCache(element_type=Song)
|
||||
ALBUM_CACHE = PageCache(element_type=Album)
|
||||
ARTIST_CACHE = PageCache(element_type=Artist)
|
||||
|
||||
API_SESSION: requests.Session = requests.Session()
|
||||
API_SESSION.proxies = shared.proxies
|
||||
TIMEOUT = 5
|
||||
@@ -160,10 +151,6 @@ class Page:
|
||||
tracklist of every album of the artist.
|
||||
:return detailed_music_object: IT MODIFIES THE INPUT OBJ
|
||||
"""
|
||||
|
||||
cls.ARTIST_CACHE.clear()
|
||||
cls.ALBUM_CACHE.clear()
|
||||
cls.SONG_CACHE.clear()
|
||||
|
||||
if type(music_object) == Song:
|
||||
song = cls.fetch_song_details(music_object, flat=flat)
|
||||
|
@@ -151,11 +151,11 @@ class Musify(Page):
|
||||
|
||||
artist_thumbnail = image_soup.get("src")
|
||||
|
||||
return cls.ARTIST_CACHE.append(Artist(
|
||||
return Artist(
|
||||
_id=_id,
|
||||
name=name,
|
||||
source_list=source_list
|
||||
))
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def parse_album_contact(cls, contact: BeautifulSoup) -> Album:
|
||||
@@ -700,13 +700,13 @@ class Musify(Page):
|
||||
if note_soup is not None:
|
||||
notes.html = note_soup.decode_contents()
|
||||
|
||||
return cls.ARTIST_CACHE.append(Artist(
|
||||
return Artist(
|
||||
_id=url.musify_id,
|
||||
name=name,
|
||||
country=country,
|
||||
source_list=source_list,
|
||||
notes=notes
|
||||
))
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def fetch_artist_from_source(cls, source: Source, flat: bool = False) -> Artist:
|
||||
@@ -842,7 +842,7 @@ class Musify(Page):
|
||||
_artist_name = meta_artist_name_text
|
||||
|
||||
if _artist_name is not None or _artist_src is not None:
|
||||
artist_list.append(cls.ARTIST_CACHE.append(Artist(name=_artist_name, source_list=_artist_src)))
|
||||
artist_list.append(Artist(name=_artist_name, source_list=_artist_src))
|
||||
|
||||
return Song(
|
||||
title=song_name,
|
||||
|
Reference in New Issue
Block a user