4 files + 44 − 14 Inline Compare changes Side-by-side Inline Show whitespace changes Files 4 addon.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="script.spotify.screensaver" name="Spotify Screensaver" version="0.0.10" version="0.0.11" provider-name="Benoît Harrault"> <requires> <import addon="xbmc.python" version="2.25.0"/> Loading gui.py +35 −10 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ import random import xbmc import xbmcaddon import xbmcgui import json # Plugin data and configuration ADDON_ID = 'script.spotify.screensaver' Loading @@ -22,6 +23,9 @@ class GUI(xbmcgui.WindowXMLDialog): self.isExiting = False def log(self, msg, level=xbmc.LOGDEBUG): if self.force_debug: level = xbmc.LOGERROR xbmc.log(ADDON_ID + ' - ' + ADDON_VERSION + ' - ' + msg, level) def onInit(self): Loading Loading @@ -65,6 +69,8 @@ class GUI(xbmcgui.WindowXMLDialog): self.spotify_client_secret = SETTINGS.getSetting( 'SpotifyClientSecret').decode('utf-8') self.force_debug = SETTINGS.getSetting('ForceDebug') == 'true' def _init_spotify_access_token(self): auth_response = requests.post(SPOTIFY_AUTH_URL, { 'grant_type': 'client_credentials', Loading Loading @@ -137,27 +143,26 @@ class GUI(xbmcgui.WindowXMLDialog): def _unimplemented_event_type(self, event_type, event_value): self.log( 'unimplemented event type: ' + str(event_type) + ' (value: ' + str(event_value) + ')', xbmc.LOGDEBUG + ' (value: ' + str(event_value) + ')' ) def _preload_images(self, track_id): self.log('preload images for track: ' + track_id, xbmc.LOGERROR) self.log('preload images for track: ' + track_id) self._get_track_data(track_id) def _reload_images(self, track_id): self.log('load images for track: ' + track_id, xbmc.LOGERROR) self.log('load images for track: ' + track_id) self.PanelItems = self.getControl(101) self.PanelItems.reset() self.PanelItems.addItems(self._get_track_data(track_id)) def _remove_images(self): self.log('no played track. remove images', xbmc.LOGERROR) self.log('no played track. remove images') self.PanelItems = self.getControl(101) self.PanelItems.reset() def _get_track_data(self, track_id): self.log('track_id: [' + str(track_id) + ']', xbmc.LOGERROR) self.log('track_id: [' + str(track_id) + ']') imageLST = [] Loading @@ -178,13 +183,33 @@ class GUI(xbmcgui.WindowXMLDialog): # album/track image album = data.get('album') if album is not None: if album is None: self.log('failed to get album from API', xbmc.LOGERROR) self.log(json.dumps(data), xbmc.LOGERROR) else: self.log('ok got album from API') self.log(json.dumps(album)) images = album.get('images') if images is not None: if images is None: self.log('failed to get images from API', xbmc.LOGERROR) self.log(json.dumps(album), xbmc.LOGERROR) else: self.log('ok got images from API') self.log(json.dumps(images)) image = images[0] if image is not None: if image is None: self.log('failed to get image from API', xbmc.LOGERROR) self.log(json.dumps(images), xbmc.LOGERROR) else: self.log('ok got image from API') self.log(json.dumps(image)) image_url = image.get('url') if image_url is not None: if image_url is None: self.log('failed to get image_url from API', xbmc.LOGERROR) self.log(json.dumps(image), xbmc.LOGERROR) else: self.log('ok got image_url from API') self.log(image_url) imageLST.append( xbmcgui.ListItem( track_name, thumbnailImage=image_url) Loading resources/language/resource.language.en_gb/strings.po +4 −0 Original line number Diff line number Diff line Loading @@ -35,3 +35,7 @@ msgstr "Spotify Client Id" msgctxt "#32005" msgid "SpotifyClientSecret" msgstr "Spotify Client Secret" msgctxt "#32006" msgid "ForceDebug" msgstr "Force debug" resources/settings.xml +4 −3 Original line number Diff line number Diff line Loading @@ -5,4 +5,5 @@ <setting id="Animate" type="bool" label="32003" default="false"/> <setting id="SpotifyClientId" type="text" label="32004" default="SpotifyClientId"/> <setting id="SpotifyClientSecret" type="text" label="32005" default="SpotifyClientSecret"/> <setting id="ForceDebug" type="bool" label="32006" default="false"/> </settings>
addon.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="script.spotify.screensaver" name="Spotify Screensaver" version="0.0.10" version="0.0.11" provider-name="Benoît Harrault"> <requires> <import addon="xbmc.python" version="2.25.0"/> Loading
gui.py +35 −10 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ import random import xbmc import xbmcaddon import xbmcgui import json # Plugin data and configuration ADDON_ID = 'script.spotify.screensaver' Loading @@ -22,6 +23,9 @@ class GUI(xbmcgui.WindowXMLDialog): self.isExiting = False def log(self, msg, level=xbmc.LOGDEBUG): if self.force_debug: level = xbmc.LOGERROR xbmc.log(ADDON_ID + ' - ' + ADDON_VERSION + ' - ' + msg, level) def onInit(self): Loading Loading @@ -65,6 +69,8 @@ class GUI(xbmcgui.WindowXMLDialog): self.spotify_client_secret = SETTINGS.getSetting( 'SpotifyClientSecret').decode('utf-8') self.force_debug = SETTINGS.getSetting('ForceDebug') == 'true' def _init_spotify_access_token(self): auth_response = requests.post(SPOTIFY_AUTH_URL, { 'grant_type': 'client_credentials', Loading Loading @@ -137,27 +143,26 @@ class GUI(xbmcgui.WindowXMLDialog): def _unimplemented_event_type(self, event_type, event_value): self.log( 'unimplemented event type: ' + str(event_type) + ' (value: ' + str(event_value) + ')', xbmc.LOGDEBUG + ' (value: ' + str(event_value) + ')' ) def _preload_images(self, track_id): self.log('preload images for track: ' + track_id, xbmc.LOGERROR) self.log('preload images for track: ' + track_id) self._get_track_data(track_id) def _reload_images(self, track_id): self.log('load images for track: ' + track_id, xbmc.LOGERROR) self.log('load images for track: ' + track_id) self.PanelItems = self.getControl(101) self.PanelItems.reset() self.PanelItems.addItems(self._get_track_data(track_id)) def _remove_images(self): self.log('no played track. remove images', xbmc.LOGERROR) self.log('no played track. remove images') self.PanelItems = self.getControl(101) self.PanelItems.reset() def _get_track_data(self, track_id): self.log('track_id: [' + str(track_id) + ']', xbmc.LOGERROR) self.log('track_id: [' + str(track_id) + ']') imageLST = [] Loading @@ -178,13 +183,33 @@ class GUI(xbmcgui.WindowXMLDialog): # album/track image album = data.get('album') if album is not None: if album is None: self.log('failed to get album from API', xbmc.LOGERROR) self.log(json.dumps(data), xbmc.LOGERROR) else: self.log('ok got album from API') self.log(json.dumps(album)) images = album.get('images') if images is not None: if images is None: self.log('failed to get images from API', xbmc.LOGERROR) self.log(json.dumps(album), xbmc.LOGERROR) else: self.log('ok got images from API') self.log(json.dumps(images)) image = images[0] if image is not None: if image is None: self.log('failed to get image from API', xbmc.LOGERROR) self.log(json.dumps(images), xbmc.LOGERROR) else: self.log('ok got image from API') self.log(json.dumps(image)) image_url = image.get('url') if image_url is not None: if image_url is None: self.log('failed to get image_url from API', xbmc.LOGERROR) self.log(json.dumps(image), xbmc.LOGERROR) else: self.log('ok got image_url from API') self.log(image_url) imageLST.append( xbmcgui.ListItem( track_name, thumbnailImage=image_url) Loading
resources/language/resource.language.en_gb/strings.po +4 −0 Original line number Diff line number Diff line Loading @@ -35,3 +35,7 @@ msgstr "Spotify Client Id" msgctxt "#32005" msgid "SpotifyClientSecret" msgstr "Spotify Client Secret" msgctxt "#32006" msgid "ForceDebug" msgstr "Force debug"
resources/settings.xml +4 −3 Original line number Diff line number Diff line Loading @@ -5,4 +5,5 @@ <setting id="Animate" type="bool" label="32003" default="false"/> <setting id="SpotifyClientId" type="text" label="32004" default="SpotifyClientId"/> <setting id="SpotifyClientSecret" type="text" label="32005" default="SpotifyClientSecret"/> <setting id="ForceDebug" type="bool" label="32006" default="false"/> </settings>