Example #1
0
    def objectFromID(self, object_type, ids):
        try:
            uris = [SpotifyUtil.id2uri(object_type, id) for id in ids]
        except:
            uris = SpotifyUtil.id2uri(object_type, ids)

        return self.objectFromURI(uris, asArray=True)
Example #2
0
def track_uri_callback(sp, result):
	global currentLid, currentTracks, currentTrackI, currentPlaylistId
	if "type" in result and result["type"] == 3:
		Logging.notice("Track is not available. Skipping.")
		do_next_queue(sp)
		return

	#We need to "end" the previous track
	if currentTrackI > 0:	
		#Get the last track
		currentTrack = currentTracks[currentTrackI - 1]
		trackUri = SpotifyUtil.id2uri("track", SpotifyUtil.gid2id(currentTrack.gid))
		sp.track_end(currentLid, 0, 97, trackUri, sp.username, currentPlaylistId, None)

	currentTrack = currentTracks[currentTrackI]
	trackUri = SpotifyUtil.id2uri("track", SpotifyUtil.gid2id(currentTrack.gid))

	lid = result["lid"]
	url = result["uri"]
	currentLid = lid

	print "Got URL for: " + currentTrack.name + " - " + currentTrack.artist[0].name

	sp.track_event(lid, 3, 0, None)
	sp.track_progress(lid, 500, 97, sp.username, currentPlaylistId, trackUri, None)
	sp.track_event(lid, 4, 500, None)
	sp.send_command("sp/echo", ["h"])
	sp.send_command("sp/log", [30, 1, "heartbeat", 77, 77, 2, False])	
	time.sleep(1)
	do_next_queue(sp)
Example #3
0
    def objectFromID(self, object_type, ids):
        try:
            uris = [SpotifyUtil.id2uri(object_type, id) for id in ids]
        except:
            uris = SpotifyUtil.id2uri(object_type, ids)

        return self.objectFromURI(uris, asArray=True)
Example #4
0
def do_next_queue(sp):
	global currentTracks, currentTrackI
	currentTrackI += 1	
	if currentTrackI >= len(currentTracks):	
		print("Done!")	
		return

	track = currentTracks[currentTrackI]

	trackId = SpotifyUtil.gid2id(track.gid)
	trackUri = SpotifyUtil.id2uri("track", trackId)

	sp.track_uri(trackId, "mp3160", track_uri_callback)
Example #5
0
 def update(self, node=None):
     self.uri = SpotifyUtil.id2uri('track', self.id)
Example #6
0
    def update(self, node=None):
        self.uri = SpotifyUtil.id2uri('album', self.id)

        if node:
            self.update_covers(node)
Example #7
0
 def update(self, node=None):
     self.uri = SpotifyUtil.id2uri('artist', self.id)
Example #8
0
 def update(self, node=None):
     self.uri = SpotifyUtil.id2uri('track', self.id)
Example #9
0
    def update(self, node=None):
        self.uri = SpotifyUtil.id2uri('album', self.id)

        if node:
            self.update_covers(node)
Example #10
0
 def update(self, node=None):
     self.uri = SpotifyUtil.id2uri('artist', self.id)