File tree 2 files changed +18
-10
lines changed
2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 1
1
Rebol [
2
2
Title: "Spotify"
3
3
Purpose: "Spotify Web API access"
4
- Version: 0.2.0
4
+ Version: 0.2.1
5
5
Author: @Oldes
6
6
Date: 20-Jul-2023
7
7
File: %spotify.reb
@@ -267,13 +267,16 @@ refresh: function[
267
267
])
268
268
]
269
269
data: attempt [load-json result/3 ]
270
- either result/1 >= 400 [
270
+ if result/1 >= 400 [
271
271
sys/log/error 'SPOTIFY "Failed to refresh access token!"
272
272
if data/error_description [ sys/log/error 'SPOTIFY data/error_description ]
273
- none
274
- ][
275
- ctx/token: data
273
+ return none
276
274
]
275
+ try /with [
276
+ data/expires_in: now + (to time! data/expires_in )
277
+ ctx/token: data
278
+ store-config ctx
279
+ ] :print
277
280
]
278
281
279
282
request : func [
Original file line number Diff line number Diff line change 1
1
Rebol [
2
2
Title: "Test Spotify module"
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
Author: @Oldes
5
5
Date: 20-Jul-2023
6
6
File: %test-spotify.r3
@@ -11,17 +11,20 @@ system/options/quiet: false ;; allow Spotify traces
11
11
system/options/log/spotify: 4 ;; verbose
12
12
system/options/log/http: 0 ;; no HTTP traces
13
13
14
- ;; make sure that we load a fresh extension
15
- try [system/modules/spotify: none]
16
- spotify: import %spotify.reb
14
+ spotify: import spotify
17
15
18
16
test-all?: false ;; I don't want CI tests to stop my real playback
19
17
18
+ errors: 0 ;; error counter (process return value)
19
+
20
20
do-test : func [ title code] [
21
21
print-horizontal-line
22
22
print as-yellow title
23
23
probe code
24
- try /with code :print
24
+ try /with code [
25
+ print system/state/last-error
26
+ ++ errors
27
+ ]
25
28
]
26
29
27
30
@@ -182,3 +185,5 @@ if test-all? [
182
185
probe spotify/put %me/player/seek?position_ms=0
183
186
]
184
187
]
188
+
189
+ quit /return errors
You can’t perform that action at this time.
0 commit comments