示例#1
0
def send_audio():
	path = check_string(request, params.PATH)

	if not check_path(path):
		path = None

	if path == None:
		return send_error(error_codes.INVALID_PATH, "You need to specify path parameter")
	if not file_exsists(path):
		return send_no_file_error(path)

	return send_from_directory(directory = os.path.dirname(path), filename = os.path.basename(path))	
示例#2
0
def get_metadata():
	path = check_string(request, params.PATH)

	if path == None:
		return send_error(error_codes.INVALID_PATH, "You need to specify path parameter")

	if not file_exsists(path):
		return send_no_file_error(path)

	respone = explorer.getMetadata(path)
	respone['code'] = error_codes.SUCCESFULL_QUERY

	return jsonify(respone)
示例#3
0
def play_track():
	currentTrack = trackThreader.currentTrack()

	trackPath = check_string(request, params.PATH)
	terminate = check_boolean(request, params.TERMINATE)

	if not file_exsists(trackPath) or not check_path(trackPath):
		return send_no_file_error(trackPath)

	if currentTrack == None:
		return startTrack(trackPath)
	else:
		if terminate:
			currentTrack.stop()
			trackThreader.setTrack(None)
			return startTrack(trackPath)

		return send_error(error_codes.TRACK_ALREADY_PLAYING, "Track already exsists")