This commit is contained in:
Lukas Schulz 2020-12-19 21:34:44 +01:00
parent c660d2b67a
commit b0de5cca7c

17
main.py
View file

@ -1,23 +1,26 @@
import sys import sys
import spotipy import spotipy
import spotipy.util as util import spotipy.util as util
import config as cfg
from PIL import Image from PIL import Image
import requests import requests
from io import BytesIO from io import BytesIO
import configparser
configParser = configparser.RawConfigParser()
configFilePath = 'config.conf'
client_id = cfg.client_id
client_secret = cfg.client_secret
redirect_uri = cfg.redirect_uri
username = cfg.username
scope = 'user-read-currently-playing' scope = 'user-read-currently-playing'
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print("Usage: %s username" % (sys.argv[0],))
sys.exit()
token = util.prompt_for_user_token(username, scope)
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
if token: if token:
sp = spotipy.Spotify(auth=token) sp = spotipy.Spotify(auth=token)