def route_player_open_new_file(request, file):
    global current_thing_playing
    path_to_file = file_container.match_hash_for_file(file)
    current_thing_playing = file_container.match_hash_for_file_name(file)
    global player
    if player is not None:
        player.quit()
	kill_player_pids(dbus_daemon_handle)
        player = OMXPlayer(path_to_file)
	player.play()
    else:
    	player = OMXPlayer(path_to_file)
    	player.play()
    return path_to_file
def route_player_open_new_file(request, file):
    global current_thing_playing
    path_to_file = file_container.match_hash_for_file(file)
    current_thing_playing = file_container.match_hash_for_file_name(file)
    global player
    if player is not None:
        player.quit()
	kill_player_pids(dbus_daemon_handle)
        player = OMXPlayer(path_to_file)
	player.play()
    else:
    	player = OMXPlayer(path_to_file)
    	player.play()
    return path_to_file

"""
Increase the volume incrementally
"""
@app.route('/player/volume_up')
def route_volume_upi(request):
    volume_up_value = .2
    player.set_volume(volume_up_value)
    return ""

if __name__ == '__main__':
    try:
    	t = TorrentManager()
	app.run(host='0.0.0.0', port=8080)
    except KeyboardInterrupt:
        kill_player_pids(dbus_daemon_handle)