Ejemplo n.º 1
0
def check_playlists():
	qry_str = 'SELECT * FROM playlist'
	
	results = connection.execute(qry_str)
	
	if results:
		for row in results.fetchall():
			time_created = str(row['id'])		# id of playlist is the unix time stampe

			time_interval = int(time.time()) - int(time_created)
			minutes = int(time_interval/60)		# get minutes passed by since time of creation

			if minutes > 1440:					# if playlist exists for more than 24 hours, delete
				print('DELETING PLAYLIST ' + time_created)
				# delete playlist 
				qry_str = ("""DELETE FROM playlist WHERE id='%s'""" % (time_created))
				connection.execute(qry_str)

				# delete songs in the playlist
				qry_str = ("""SELECT * from tracks WHERE playlistid='%s'""" % (time_created))
				results = connection.execute(qry_str)

				for track in results.fetchall():
					deleteTrack(track['trackid'])
	else:
		raise Exception(sys.argv[0:]) 
Ejemplo n.º 2
0
def deleteTrackHandler():
	track_id = request.args.get('track_id')
	deleteTrack(track_id)
	return jsonify({'message':'success'})
Ejemplo n.º 3
0
def deleteTrackHandler():
    track_id = request.args.get('track_id')
    deleteTrack(track_id)
    return jsonify({'message': 'success'})