From 37b10835c3a9bfc9e3dfdde9f68296cd09f37771 Mon Sep 17 00:00:00 2001 From: Graham McMicken Date: Thu, 4 Nov 2021 22:41:05 -0700 Subject: [PATCH 1/4] Bugfix #261 and bump version. --- Makefile | 2 +- custom_components/spotcast/__init__.py | 6 ++--- custom_components/spotcast/manifest.json | 5 ++-- .../spotcast/spotcast_controller.py | 26 +++++++++---------- setup.cfg | 2 +- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 26cc0eff..7034b184 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -__VERSION__ = "3.6.19" +__VERSION__ = "3.6.20" bump: bump2version --allow-dirty --current-version $(__VERSION__) patch Makefile custom_components/spotcast/manifest.json diff --git a/custom_components/spotcast/__init__.py b/custom_components/spotcast/__init__.py index a55786e1..b7c64cd2 100644 --- a/custom_components/spotcast/__init__.py +++ b/custom_components/spotcast/__init__.py @@ -42,12 +42,12 @@ def setup(hass, config): - + # get spotify core integration status if not helpers.get_spotify_install_status(hass): - _LOGGER.error("Spotify integration was not found, aborting setup...") + _LOGGER.error("Spotify integration was not found, please verify integration is functionnal. Could result in python error...") return False - + """Setup the Spotcast service.""" conf = config[DOMAIN] diff --git a/custom_components/spotcast/manifest.json b/custom_components/spotcast/manifest.json index 472f7d36..10e95386 100644 --- a/custom_components/spotcast/manifest.json +++ b/custom_components/spotcast/manifest.json @@ -7,12 +7,13 @@ "requirements": [ "spotify_token==1.0.0" ], - "version": "v3.6.19", + "version": "v3.6.20", "dependencies": [ "spotify" ], "after_dependencies": [ - "cast" + "cast", + "spotify" ], "codeowners": [ "@fondberg" diff --git a/custom_components/spotcast/spotcast_controller.py b/custom_components/spotcast/spotcast_controller.py index 6cb86bce..9c09f74b 100644 --- a/custom_components/spotcast/spotcast_controller.py +++ b/custom_components/spotcast/spotcast_controller.py @@ -276,10 +276,17 @@ def get_playlists(self, account, playlist_type, country_code, locale, limit): resp = {} if playlist_type == "discover-weekly": - playlist_type = "made-for-x" - - if playlist_type == "user" or playlist_type == "default" or playlist_type == "": - resp = client.current_user_playlists(limit=limit) + resp = client._get( + "views/made-for-x", + content_limit=limit, + locale=locale, + platform="web", + types="album,playlist,artist,show,station", + limit=limit, + offset=0, + ) + resp = resp.get("content") + elif playlist_type == "featured": resp = client.featured_playlists( locale=locale, @@ -290,15 +297,6 @@ def get_playlists(self, account, playlist_type, country_code, locale, limit): ) resp = resp.get("playlists") else: - resp = client._get( - "views/" + playlist_type, - content_limit=limit, - locale=locale, - platform="web", - types="album,playlist,artist,show,station", - limit=limit, - offset=0, - ) - resp = resp.get("content") + resp = client.current_user_playlists(limit=limit) return resp diff --git a/setup.cfg b/setup.cfg index 5a25bce0..582d34b7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.6.19 +current_version = 3.6.20 [flake8] exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build From af5f49f74ed0cfcbf97deb86243a2ea98eef8b74 Mon Sep 17 00:00:00 2001 From: Graham McMicken Date: Thu, 4 Nov 2021 22:45:56 -0700 Subject: [PATCH 2/4] Bugfix #261 and bump version. --- Makefile | 2 +- custom_components/spotcast/manifest.json | 2 +- custom_components/spotcast/sensor.py | 2 +- setup.cfg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7034b184..7fd1b1aa 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -__VERSION__ = "3.6.20" +__VERSION__ = "3.6.21" bump: bump2version --allow-dirty --current-version $(__VERSION__) patch Makefile custom_components/spotcast/manifest.json diff --git a/custom_components/spotcast/manifest.json b/custom_components/spotcast/manifest.json index 10e95386..0e1e0f22 100644 --- a/custom_components/spotcast/manifest.json +++ b/custom_components/spotcast/manifest.json @@ -7,7 +7,7 @@ "requirements": [ "spotify_token==1.0.0" ], - "version": "v3.6.20", + "version": "v3.6.21", "dependencies": [ "spotify" ], diff --git a/custom_components/spotcast/sensor.py b/custom_components/spotcast/sensor.py index 200cbe0a..28ca0fe4 100755 --- a/custom_components/spotcast/sensor.py +++ b/custom_components/spotcast/sensor.py @@ -89,7 +89,7 @@ def device_state_attributes(self): def update(self): _LOGGER.debug("Getting playlists") - playlist_type = "playlists" + playlist_type = "user" country_code = "SE" locale = "en" limit = 10 diff --git a/setup.cfg b/setup.cfg index 582d34b7..10af6db7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.6.20 +current_version = 3.6.21 [flake8] exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build From e681378b5e33c52550e93652c823d7db266cf16d Mon Sep 17 00:00:00 2001 From: Felix Cusson <60357894+Darkfull-Dante@users.noreply.github.com> Date: Fri, 5 Nov 2021 13:08:45 -0400 Subject: [PATCH 3/4] readded new playlist functionnality --- .../spotcast/spotcast_controller.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/custom_components/spotcast/spotcast_controller.py b/custom_components/spotcast/spotcast_controller.py index 9c09f74b..abac2b31 100644 --- a/custom_components/spotcast/spotcast_controller.py +++ b/custom_components/spotcast/spotcast_controller.py @@ -276,17 +276,10 @@ def get_playlists(self, account, playlist_type, country_code, locale, limit): resp = {} if playlist_type == "discover-weekly": - resp = client._get( - "views/made-for-x", - content_limit=limit, - locale=locale, - platform="web", - types="album,playlist,artist,show,station", - limit=limit, - offset=0, - ) - resp = resp.get("content") + playlist_type = "made-for-x" + if playlist_type == "user" or playlist_type == "default" or playlist_type == "": + resp = client.current_user_playlists(limit=limit) elif playlist_type == "featured": resp = client.featured_playlists( locale=locale, @@ -297,6 +290,15 @@ def get_playlists(self, account, playlist_type, country_code, locale, limit): ) resp = resp.get("playlists") else: - resp = client.current_user_playlists(limit=limit) + resp = client._get( + "views/" + playlist_type, + content_limit=limit, + locale=locale, + platform="web", + types="album,playlist,artist,show,station", + limit=limit, + offset=0, + ) + resp = resp.get("content") return resp From 1c67d29af104fcac0274f22ad30eea92b1201c5d Mon Sep 17 00:00:00 2001 From: Felix Cusson <60357894+Darkfull-Dante@users.noreply.github.com> Date: Fri, 5 Nov 2021 16:24:13 -0400 Subject: [PATCH 4/4] remove abort setup #258 still a problem, will keep error message as debug for future release --- custom_components/spotcast/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/spotcast/__init__.py b/custom_components/spotcast/__init__.py index b7c64cd2..188ff774 100644 --- a/custom_components/spotcast/__init__.py +++ b/custom_components/spotcast/__init__.py @@ -44,9 +44,10 @@ def setup(hass, config): # get spotify core integration status + # if return false, could indicate a bad spotify integration. Race + # condition doesn't permit us to abort setup, see #258 if not helpers.get_spotify_install_status(hass): - _LOGGER.error("Spotify integration was not found, please verify integration is functionnal. Could result in python error...") - return False + _LOGGER.debug("Spotify integration was not found, please verify integration is functionnal. Could result in python error...") """Setup the Spotcast service.""" conf = config[DOMAIN]