mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
Update artist image download message and lyrics plugin URL
This commit is contained in:
+2
-2
@@ -102,10 +102,10 @@ class Populate:
|
|||||||
CheckArtistImages(instance_key)
|
CheckArtistImages(instance_key)
|
||||||
except (RequestConnectionError, ReadTimeout) as e:
|
except (RequestConnectionError, ReadTimeout) as e:
|
||||||
log.error(
|
log.error(
|
||||||
"Internet connection lost. Downloading artist images stopped."
|
"Internet connection lost. Downloading artist images suspended."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
log.warning(f"No internet connection. Downloading artist images stopped!")
|
log.warning(f"No internet connection. Downloading artist images suspended!")
|
||||||
|
|
||||||
# Re-process the new artist images.
|
# Re-process the new artist images.
|
||||||
if tried_to_download_new_images:
|
if tried_to_download_new_images:
|
||||||
|
|||||||
@@ -46,15 +46,14 @@ class LyricsProvider(LRCProvider):
|
|||||||
Musixmatch provider class
|
Musixmatch provider class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ROOT_URL = Keys.PLUGIN_LYRICS_ROOT_URL
|
ROOT_URL = "https://apic-desktop.musixmatch.com/ws/1.1/"
|
||||||
get_token_trials = 0
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.token = None
|
self.token = None
|
||||||
self.session.headers.update(
|
self.session.headers.update(
|
||||||
{
|
{
|
||||||
"authority": Keys.PLUGIN_LYRICS_AUTHORITY,
|
"authority": "apic-desktop.musixmatch.com",
|
||||||
"cookie": "AWSELBCORS=0; AWSELB=0",
|
"cookie": "AWSELBCORS=0; AWSELB=0",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -86,10 +85,6 @@ class LyricsProvider(LRCProvider):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_token(self):
|
def _get_token(self):
|
||||||
if self.get_token_trials > 3:
|
|
||||||
self.get_token_trials = 0
|
|
||||||
return
|
|
||||||
|
|
||||||
# Check if token is cached and not expired
|
# Check if token is cached and not expired
|
||||||
plugin_path = Paths.get_lyrics_plugins_path()
|
plugin_path = Paths.get_lyrics_plugins_path()
|
||||||
token_path = os.path.join(plugin_path, "token.json")
|
token_path = os.path.join(plugin_path, "token.json")
|
||||||
@@ -116,12 +111,10 @@ class LyricsProvider(LRCProvider):
|
|||||||
res = res.json()
|
res = res.json()
|
||||||
if res["message"]["header"]["status_code"] == 401:
|
if res["message"]["header"]["status_code"] == 401:
|
||||||
time.sleep(13)
|
time.sleep(13)
|
||||||
self.get_token_trials += 1
|
|
||||||
return self._get_token()
|
return self._get_token()
|
||||||
|
|
||||||
new_token = res["message"]["body"]["user_token"]
|
new_token = res["message"]["body"]["user_token"]
|
||||||
expiration_time = current_time + 600 # 10 minutes expiration
|
expiration_time = current_time + 600 # 10 minutes expiration
|
||||||
self.get_token_trials = 0
|
|
||||||
|
|
||||||
# Cache the new token
|
# Cache the new token
|
||||||
self.token = new_token
|
self.token = new_token
|
||||||
|
|||||||
@@ -234,9 +234,6 @@ class TCOLOR:
|
|||||||
|
|
||||||
|
|
||||||
class Keys:
|
class Keys:
|
||||||
# get last fm api key from os environment
|
|
||||||
PLUGIN_LYRICS_AUTHORITY = os.environ.get("apic-desktop.musixmatch.com")
|
|
||||||
PLUGIN_LYRICS_ROOT_URL = os.environ.get("https://apic-desktop.musixmatch.com/ws/1.1/")
|
|
||||||
SWINGMUSIC_APP_VERSION = os.environ.get("SWINGMUSIC_APP_VERSION")
|
SWINGMUSIC_APP_VERSION = os.environ.get("SWINGMUSIC_APP_VERSION")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ class ArtistStore:
|
|||||||
ARTIST_LOAD_KEY = instance_key
|
ARTIST_LOAD_KEY = instance_key
|
||||||
|
|
||||||
print("Loading artists... ", end="")
|
print("Loading artists... ", end="")
|
||||||
cls.artists.extend(
|
cls.artists.clear()
|
||||||
get_all_artists(TrackStore.tracks, AlbumStore.albums)
|
|
||||||
)
|
cls.artists.extend(get_all_artists(TrackStore.tracks, AlbumStore.albums))
|
||||||
print("Done!")
|
print("Done!")
|
||||||
for artist in ardb.get_all_artists():
|
for artist in ardb.get_all_artists():
|
||||||
if instance_key != ARTIST_LOAD_KEY:
|
if instance_key != ARTIST_LOAD_KEY:
|
||||||
|
|||||||
@@ -7,8 +7,12 @@ class CustomList(list):
|
|||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
# Do some shared memory stuff here
|
# Do some shared memory stuff here
|
||||||
|
# print the length of the list
|
||||||
|
# print(f"__getitem__ Length of the list: {len(self)}")
|
||||||
return super().__getitem__(index)
|
return super().__getitem__(index)
|
||||||
|
|
||||||
def __iter__(self) -> Iterator:
|
def __iter__(self) -> Iterator:
|
||||||
# Do some shared memory stuff here
|
# Do some shared memory stuff here
|
||||||
|
# print the length of the list
|
||||||
|
# print(f"__iter__ Length of the list: {len(self)}")
|
||||||
return super().__iter__()
|
return super().__iter__()
|
||||||
|
|||||||
Reference in New Issue
Block a user