handling optional access key, added player
This commit is contained in:
parent
435f16b779
commit
0cc962cf0d
@ -23,8 +23,8 @@ def create_playlist(username, name):
|
|||||||
|
|
||||||
net = Network(NetworkUser(spotify_keys['clientid'],
|
net = Network(NetworkUser(spotify_keys['clientid'],
|
||||||
spotify_keys['clientsecret'],
|
spotify_keys['clientsecret'],
|
||||||
user_dict['access_token'],
|
user_dict['refresh_token'],
|
||||||
user_dict['refresh_token']))
|
user_dict['access_token']))
|
||||||
|
|
||||||
resp = net.create_playlist(net.user.username, name)
|
resp = net.create_playlist(net.user.username, name)
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ from spotframework.engine.processor.deduplicate import DeduplicateByID
|
|||||||
|
|
||||||
from spotframework.net.network import Network
|
from spotframework.net.network import Network
|
||||||
from spotframework.net.user import NetworkUser
|
from spotframework.net.user import NetworkUser
|
||||||
|
from spotframework.player.player import Player
|
||||||
import spotify.db.database as database
|
import spotify.db.database as database
|
||||||
from spotify.db.part_generator import PartGenerator
|
from spotify.db.part_generator import PartGenerator
|
||||||
|
|
||||||
@ -55,12 +56,14 @@ def play_user_playlist(username,
|
|||||||
|
|
||||||
net = Network(NetworkUser(spotify_keys['clientid'],
|
net = Network(NetworkUser(spotify_keys['clientid'],
|
||||||
spotify_keys['clientsecret'],
|
spotify_keys['clientsecret'],
|
||||||
user_dict['access_token'],
|
user_dict['refresh_token'],
|
||||||
user_dict['refresh_token']))
|
user_dict['access_token']))
|
||||||
|
|
||||||
engine = PlaylistEngine(net)
|
engine = PlaylistEngine(net)
|
||||||
engine.load_user_playlists()
|
engine.load_user_playlists()
|
||||||
|
|
||||||
|
player = Player(net)
|
||||||
|
|
||||||
processors = [DeduplicateByID()]
|
processors = [DeduplicateByID()]
|
||||||
|
|
||||||
if shuffle:
|
if shuffle:
|
||||||
@ -92,7 +95,7 @@ def play_user_playlist(username,
|
|||||||
include_recommendations=include_recommendations,
|
include_recommendations=include_recommendations,
|
||||||
recommendation_limit=int(recommendation_sample))
|
recommendation_limit=int(recommendation_sample))
|
||||||
|
|
||||||
net.play(uris=[i.uri for i in tracks])
|
player.play(tracks=tracks)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.critical(f'multiple/no user(s) found ({username})')
|
logger.critical(f'multiple/no user(s) found ({username})')
|
||||||
|
@ -48,8 +48,8 @@ def run_user_playlist(username, playlist_name):
|
|||||||
|
|
||||||
net = Network(NetworkUser(spotify_keys['clientid'],
|
net = Network(NetworkUser(spotify_keys['clientid'],
|
||||||
spotify_keys['clientsecret'],
|
spotify_keys['clientsecret'],
|
||||||
user_dict['access_token'],
|
user_dict['refresh_token'],
|
||||||
user_dict['refresh_token']))
|
user_dict['access_token']))
|
||||||
|
|
||||||
engine = PlaylistEngine(net)
|
engine = PlaylistEngine(net)
|
||||||
engine.load_user_playlists()
|
engine.load_user_playlists()
|
||||||
|
Loading…
Reference in New Issue
Block a user