Spotify now re-authenticates

This commit is contained in:
Krateng 2020-07-30 15:15:09 +02:00
parent 5f8e73e6c7
commit 7a4df06090
1 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ from . import MetadataInterface, utf, b64
import hashlib
import urllib.parse, urllib.request
import json
from threading import Timer
class Spotify(MetadataInterface):
name = "Spotify"
@ -34,5 +35,8 @@ class Spotify(MetadataInterface):
}
req = urllib.request.Request(**keys)
response = urllib.request.urlopen(req)
self.settings["token"] = json.loads(response.read())["access_token"]
responsedata = json.loads(response.read())
expire = responsedata["expires_in"]
self.settings["token"] = responsedata["access_token"]
Timer(expire,self.authorize).start()
return True