コード例 #1
0
def track(event, args, kwargs):
	if event is PlayerEventCallbacks.onSongChange:
		oldSong = kwargs["oldSong"]
		newSong = kwargs["newSong"]
		lastfm.onSongChange(newSong)
	if event is PlayerEventCallbacks.onSongFinished:
		song = kwargs["song"]
		lastfm.onSongFinished(song)
コード例 #2
0
def track(event, args, kwargs):
    if event is PlayerEventCallbacks.onSongChange:
        oldSong = kwargs["oldSong"]
        newSong = kwargs["newSong"]
        lastfm.onSongChange(newSong)
    if event is PlayerEventCallbacks.onSongFinished:
        song = kwargs["song"]
        lastfm.onSongFinished(song)
コード例 #3
0
ファイル: tracker_lastfm.py プロジェクト: BMXE/music-player
def track(event, args, kwargs):
	# Note that we can get an `onSongChange` when we are not playing,
	# e.g. at startup (first song) or when the user presses `nextSong`.
	# So it might make sense to delay that here...
	# We don't for now for simplicity reasons...
	if event is PlayerEventCallbacks.onSongChange:
		oldSong = kwargs["oldSong"]
		newSong = kwargs["newSong"]
		lastfm.onSongChange(newSong)
	if event is PlayerEventCallbacks.onSongFinished:
		song = kwargs["song"]
		timestamp = kwargs["timestamp"]
		lastfm.onSongFinished(song, timestamp=timestamp)
コード例 #4
0
def track(event, args, kwargs):
    # Note that we can get an `onSongChange` when we are not playing,
    # e.g. at startup (first song) or when the user presses `nextSong`.
    # So it might make sense to delay that here...
    # We don't for now for simplicity reasons...
    if event is PlayerEventCallbacks.onSongChange:
        oldSong = kwargs["oldSong"]
        newSong = kwargs["newSong"]
        lastfm.onSongChange(newSong)
    if event is PlayerEventCallbacks.onSongFinished:
        song = kwargs["song"]
        timestamp = kwargs["timestamp"]
        lastfm.onSongFinished(song, timestamp=timestamp)
コード例 #5
0
ファイル: main.py プロジェクト: iamnilay3/music-player
def track(event, args, kwargs):
	print "track:", repr(event), repr(args), repr(kwargs)
	if event is PlayerEventCallbacks.onSongChange:
		oldSong = kwargs["oldSong"]
		if oldSong: oldSong.close() # in case anyone is holding any ref to it, close at least the file
		newSong = kwargs["newSong"]
		if "artist" not in newSong.metadata:
			print "new song metadata is incomplete:", newSong.metadata
		else:
			print "new song:", newSong.fileext, ",", newSong.artist, "-", newSong.track, ",", formatTime(newSong.duration)
			pprint(newSong.metadata)
		lastfm.onSongChange(newSong)
	if event is PlayerEventCallbacks.onSongFinished:
		song = kwargs["song"]
		lastfm.onSongFinished(song)