Beispiel #1
0
def smoove():
	songs = abcdigapi._parse_input()
	song = songs[0]
	itunes_url = abcdigapi._craft_itunes_url(song["artistName"])
	return render_template('abcdigapi.html', REFRESH_INTERVAL=abcdigapi.REFRESH_INTERVAL, title=song["title"], artistName=song["artistName"],albumName=song["albumName"],dateCopyrighted=song["dateCopyrighted"],publisher=song["publisher"],itunes_url=itunes_url)
Beispiel #2
0
#	'artistNote': None,
#	'albumName': 'Santana',
#	'artistName': 'Santana', 
#	'playedTime': '13660267',
#	'albumImage': 'http://www.abc.net.au/dig/covers/santana_1.jpg', 
#	'duration': '396',
#	'trackNote': '<a href="http://www.santana.com" target= "_blank">Santana Website</a> ',
# 	'playing': 'now'}

previous_song_track_id="0"
abc_hit_count=0
abc_miss_count=0

# just loop forever.
while True:
	songs = abcdigapi._parse_input()
	current_song = songs[0]
	next_song = songs[2]
	previous_song = songs[1]
	
	# sometimes the ABC API doesn't refresh in a timeley matter, this check makes sure we are getting new
	#  track information.  If not, wait, then try again.
	if current_song["trackId"] == previous_song_track_id:
		# then this isn't a new song.  we need to wait awhile and break the while iteration and try again
		print "   we didn't get new song info, sleeping %s seconds" % (settings.sleep_after_no_new_track_info)
		time.sleep(settings.sleep_after_no_new_track_info)
		abc_miss_count = abc_miss_count + 1
		continue
	else:
		# this is a new song, so we need to forget the old one ..
		previous_song_track_id = current_song["trackId"]