Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
script.spotify.screensaver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kodi
script.spotify.screensaver
Commits
770583e2
Commit
770583e2
authored
3 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '9-improve-missing-events-file-detection-fallback' into 'master'
Resolve "Improve missing events file detection / fallback" Closes
#9
See merge request
!5
parents
f313c8e7
fa9a24cb
No related branches found
No related tags found
1 merge request
!5
Resolve "Improve missing events file detection / fallback"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addon.xml
+1
-1
1 addition, 1 deletion
addon.xml
gui.py
+19
-7
19 additions, 7 deletions
gui.py
with
20 additions
and
8 deletions
addon.xml
+
1
−
1
View file @
770583e2
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon
id=
"script.spotify.screensaver"
name=
"Spotify Screensaver"
version=
"0.0.
3
"
version=
"0.0.
4
"
provider-name=
"Benoît Harrault"
>
<requires>
<import
addon=
"xbmc.python"
version=
"2.25.0"
/>
...
...
This diff is collapsed.
Click to expand it.
gui.py
+
19
−
7
View file @
770583e2
...
...
@@ -89,7 +89,12 @@ class GUI(xbmcgui.WindowXMLDialog):
self
.
next
=
False
countdown
=
self
.
slideshow_time
# display the image for the specified amount of time
while
(
not
self
.
Monitor
.
abortRequested
())
and
(
not
self
.
stop
)
and
(
not
self
.
next
)
and
countdown
>
0
:
while
(
(
not
self
.
Monitor
.
abortRequested
())
and
(
not
self
.
stop
)
and
(
not
self
.
next
)
and
countdown
>
0
):
countdown
-=
1
xbmc
.
sleep
(
1000
)
new_last_spotify_event
=
self
.
_get_last_spotify_event
()
...
...
@@ -109,7 +114,6 @@ class GUI(xbmcgui.WindowXMLDialog):
self
.
log
(
'
spotify event:
'
+
spotify_event
)
event_split
=
spotify_event
.
split
(
'
:
'
)
event_device
=
event_split
[
0
]
event_type
=
event_split
[
1
]
event_value
=
event_split
[
2
]
if
len
(
event_split
)
>
2
else
''
...
...
@@ -137,12 +141,16 @@ class GUI(xbmcgui.WindowXMLDialog):
imageLST
=
[]
headers
=
{
'
Authorization
'
:
'
Bearer {token}
'
.
format
(
token
=
self
.
spotify_access_token
)
'
Authorization
'
:
'
Bearer {token}
'
.
format
(
token
=
self
.
spotify_access_token
)
}
try
:
response
=
requests
.
get
(
SPOTIFY_API_BASE_URL
+
'
tracks/
'
+
track_id
,
headers
=
headers
)
response
=
requests
.
get
(
SPOTIFY_API_BASE_URL
+
'
tracks/
'
+
track_id
,
headers
=
headers
)
data
=
response
.
json
()
track_name
=
data
[
'
name
'
]
...
...
@@ -156,7 +164,7 @@ class GUI(xbmcgui.WindowXMLDialog):
xbmcgui
.
ListItem
(
track_name
,
thumbnailImage
=
image_url
)
)
except
Exception
as
e
:
self
.
log
(
'
failed to get track data
'
,
xbmc
.
LOGERROR
)
self
.
log
(
'
failed to get track data
'
+
e
.
toString
()
,
xbmc
.
LOGERROR
)
return
imageLST
...
...
@@ -171,8 +179,12 @@ class GUI(xbmcgui.WindowXMLDialog):
self
.
close
()
def
_get_last_spotify_event
(
self
):
with
open
(
LIBRESPOT_EVENT_FILE
,
'
r
'
)
as
f
:
try
:
f
=
open
(
LIBRESPOT_EVENT_FILE
,
'
r
'
)
last_event
=
f
.
readlines
()[
-
1
]
finally
:
f
.
close
()
last_event
=
''
.
join
(
last_event
.
splitlines
())
return
last_event
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment