From b488b277f056a4846fde192e5707c4d1dfb2ef76 Mon Sep 17 00:00:00 2001 From: thomaslty Date: Fri, 5 Nov 2021 18:50:27 +0800 Subject: [PATCH 1/5] Update zspotify.py --- zspotify/zspotify.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zspotify/zspotify.py b/zspotify/zspotify.py index 7d934454..bae47b3e 100644 --- a/zspotify/zspotify.py +++ b/zspotify/zspotify.py @@ -79,7 +79,9 @@ class ZSpotify: @classmethod def get_auth_header(cls): return { - AUTHORIZATION: f'Bearer {cls.__get_auth_token()}'} + 'Authorization': f'Bearer {cls.__get_auth_token()}', + 'Accept-Language': 'zh' + } @classmethod def get_auth_header_and_params(cls, limit, offset): From 3e48071f60706dbc93d2772126a9fc8bce3b65d0 Mon Sep 17 00:00:00 2001 From: thomaslty Date: Fri, 5 Nov 2021 18:59:40 +0800 Subject: [PATCH 2/5] Update zspotify.py --- zspotify/zspotify.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zspotify/zspotify.py b/zspotify/zspotify.py index bae47b3e..6c3ec531 100644 --- a/zspotify/zspotify.py +++ b/zspotify/zspotify.py @@ -80,12 +80,15 @@ class ZSpotify: def get_auth_header(cls): return { 'Authorization': f'Bearer {cls.__get_auth_token()}', - 'Accept-Language': 'zh' + 'Accept-Language': f'{cls.CONFIG.get(LANGUAGE)}' } @classmethod def get_auth_header_and_params(cls, limit, offset): - return {AUTHORIZATION: f'Bearer {cls.__get_auth_token()}'}, {LIMIT: limit, OFFSET: offset} + return { + 'Authorization': f'Bearer {cls.__get_auth_token()}', + 'Accept-Language': f'{cls.CONFIG.get(LANGUAGE)}' + }, {LIMIT: limit, OFFSET: offset} @classmethod def invoke_url_with_params(cls, url, limit, offset, **kwargs): From 46a3c45cbc603a307e5b5b420b51a9c41a5ee163 Mon Sep 17 00:00:00 2001 From: thomaslty Date: Fri, 5 Nov 2021 19:00:19 +0800 Subject: [PATCH 3/5] Update const.py --- zspotify/const.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zspotify/const.py b/zspotify/const.py index a5186fe7..a47ac56a 100644 --- a/zspotify/const.py +++ b/zspotify/const.py @@ -132,5 +132,6 @@ CONFIG_DEFAULT_SETTINGS = { 'OVERRIDE_AUTO_WAIT': False, 'CHUNK_SIZE': 50000, 'SPLIT_ALBUM_DISCS': False, - 'DOWNLOAD_REAL_TIME': False + 'DOWNLOAD_REAL_TIME': False, + 'LANGUAGE': 'en' } From 87b564d609b79ed40baad84e135260dd51130ad3 Mon Sep 17 00:00:00 2001 From: Thomas Lau Date: Fri, 5 Nov 2021 11:14:09 +0000 Subject: [PATCH 4/5] fix --- zspotify/zspotify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zspotify/zspotify.py b/zspotify/zspotify.py index 6c3ec531..a3f5e600 100644 --- a/zspotify/zspotify.py +++ b/zspotify/zspotify.py @@ -80,14 +80,14 @@ class ZSpotify: def get_auth_header(cls): return { 'Authorization': f'Bearer {cls.__get_auth_token()}', - 'Accept-Language': f'{cls.CONFIG.get(LANGUAGE)}' + 'Accept-Language': f'{cls.CONFIG.get("LANGUAGE")}' } @classmethod def get_auth_header_and_params(cls, limit, offset): return { 'Authorization': f'Bearer {cls.__get_auth_token()}', - 'Accept-Language': f'{cls.CONFIG.get(LANGUAGE)}' + 'Accept-Language': f'{cls.CONFIG.get("LANGUAGE")}' }, {LIMIT: limit, OFFSET: offset} @classmethod From edbc5c78d9bccdcf2104fda497800b79b751f3ba Mon Sep 17 00:00:00 2001 From: Thomas Lau Date: Fri, 5 Nov 2021 15:50:55 +0000 Subject: [PATCH 5/5] add album artist: --- zspotify/const.py | 2 ++ zspotify/utils.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/zspotify/const.py b/zspotify/const.py index a47ac56a..a76231db 100644 --- a/zspotify/const.py +++ b/zspotify/const.py @@ -18,6 +18,8 @@ ARTIST = 'artist' ARTISTS = 'artists' +ALBUMARTIST = 'albumartist' + ARTWORK = 'artwork' TRACKS = 'tracks' diff --git a/zspotify/utils.py b/zspotify/utils.py index 038ae68d..d0dc8738 100644 --- a/zspotify/utils.py +++ b/zspotify/utils.py @@ -10,7 +10,7 @@ import music_tag import requests from const import ARTIST, TRACKTITLE, ALBUM, YEAR, DISCNUMBER, TRACKNUMBER, ARTWORK, \ - WINDOWS_SYSTEM + WINDOWS_SYSTEM, ALBUMARTIST class MusicFormat(str, Enum): @@ -102,6 +102,7 @@ def clear() -> None: def set_audio_tags(filename, artists, name, album_name, release_year, disc_number, track_number) -> None: """ sets music_tag metadata """ tags = music_tag.load_file(filename) + tags[ALBUMARTIST] = artists[0] tags[ARTIST] = conv_artist_format(artists) tags[TRACKTITLE] = name tags[ALBUM] = album_name