示例#1
0
def player():
    user_agent = parse(request.headers.get('User-Agent'))
    album_id = request.args.get("album")
    playlist_id = request.args.get("playlist")
    song_id = request.args.get("song")
    program_id = request.args.get("program")
    radio_id = request.args.get("radio")
    mv_id = request.args.get("mv")

    if album_id is not None:
        album_info = netease.netease_cloud_music("album", album_id, "1")
        songs_info = album_info["songs_info"]
        title = "%s - %s" % (album_info["album"], album_info["artist"])
        showlrc = "1"
    elif playlist_id is not None:
        playlist_info = netease.netease_cloud_music("playlist", playlist_id,
                                                    "1")
        songs_info = playlist_info["songs_info"]
        title = playlist_info["playlist"]
        showlrc = "1"
    elif song_id is not None:
        song_info = netease.netease_cloud_music("song", song_id, "1")
        title = "%s - %s" % (song_info["title"], song_info["artist"])
        songs_info = [song_info]
        showlrc = "1"
    elif program_id is not None:
        song_info = netease.netease_cloud_music("program", program_id, 0)
        title = song_info["album"]
        songs_info = [song_info]
        showlrc = "0"
    elif radio_id is not None:
        songs_info = netease.netease_cloud_music("radio", radio_id, 0)
        title = songs_info[0]["artist"]
        showlrc = "0"
    elif mv_id is not None:
        mv_info = netease.netease_cloud_music("mv", mv_id, 0)
        mv_url = mv_info["url_best"]
        title = mv_info["title"]
        pic_url = mv_info["pic_url"]
        return render_template("dplayer.html",
                               mv_url=mv_url,
                               title=title,
                               mv_id=mv_id,
                               pic_url=pic_url)
    else:
        abort(404)

    if user_agent.is_mobile:
        return render_template("aplayer_mobile.html",
                               songs_info=songs_info,
                               title=title,
                               showlrc=showlrc,
                               song_id=song_id)
    else:
        return render_template("aplayer.html",
                               songs_info=songs_info,
                               title=title,
                               showlrc=showlrc,
                               song_id=song_id)
def player():
	user_agent = parse(request.headers.get('User-Agent'))
	album_id = request.args.get("album")
	playlist_id = request.args.get("playlist")
	song_id = request.args.get("song")
	program_id = request.args.get("program")
	radio_id = request.args.get("radio")
	mv_id = request.args.get("mv")

	if album_id is not None:
		album_info = netease.netease_cloud_music("album",album_id,0)
		songs_info = album_info["songs_info"]
		title = "%s - %s" %(album_info["album"],album_info["artist"])
		showlrc = "0"
	elif playlist_id is not None:
		playlist_info = netease.netease_cloud_music("playlist",playlist_id,0)
		songs_info = playlist_info["songs_info"]
		title = playlist_info["playlist"]
		showlrc = "0"
	elif song_id is not None:
		song_info = netease.netease_cloud_music("song",song_id,1)
		title = "%s - %s" %(song_info["title"],song_info["artist"])
		songs_info = [song_info]
		showlrc = "1"
	elif program_id is not None:
		song_info = netease.netease_cloud_music("program",program_id,0)
		title = song_info["album"]
		songs_info = [song_info]
		showlrc = "0"
	elif radio_id is not None:
		songs_info = netease.netease_cloud_music("radio",radio_id,0)
		title = songs_info[0]["artist"]
		showlrc = "0"
	elif mv_id is not None:
		mv_info = netease.netease_cloud_music("mv",mv_id,0)
		mv_url = mv_info["url_best"]
		title = mv_info["title"]
		pic_url = mv_info["pic_url"]
		return render_template("dplayer.html",mv_url=mv_url,title=title,mv_id=mv_id,pic_url=pic_url)
	else:
		abort(404)

	if user_agent.is_mobile:
		return render_template("aplayer_mobile.html",songs_info=songs_info,title=title,showlrc=showlrc,song_id=song_id)
	else:
		return render_template("aplayer.html",songs_info=songs_info,title=title,showlrc=showlrc,song_id=song_id)
def iframe():
	album_id = request.args.get("album")
	playlist_id = request.args.get("playlist")
	song_id = request.args.get("song")
	program_id = request.args.get("program")
	radio_id = request.args.get("radio")
	mv_id = request.args.get("mv")

	qssl = request.args.get("qssl")
	qlrc = request.args.get("qlrc")
	qnarrow = request.args.get("qnarrow")
	max_width = request.args.get("max_width")
	autoplay = request.args.get("autoplay")

	if qnarrow is None:
		qnarrow = "false"
	else:
		pass

	if qlrc is None:
		qlrc = "0"
	else:
		pass

	if max_width is None:
		max_width = "100%"
	else:
		pass
		
	if autoplay is None:
		autoplay = "true"
	else:
		pass
	if album_id is not None:
		album_info = netease.netease_cloud_music("album",album_id,0)
		songs_info = album_info["songs_info"]
		title = "%s - %s" %(album_info["album"],album_info["artist"])
		showlrc = "0"
	elif playlist_id is not None:
		playlist_info = netease.netease_cloud_music("playlist",playlist_id,0)
		songs_info = playlist_info["songs_info"]
		title = playlist_info["playlist"]
		showlrc = "0"
	elif song_id is not None:
		song_info = netease.netease_cloud_music("song",song_id,1)
		title = "%s - %s" %(song_info["title"],song_info["artist"])
		songs_info = [song_info]
		if qssl == "1":
			songs_info[0]["url_best"] = "https://music.daoapp.io/ssl/"+base64.urlsafe_b64encode(songs_info[0]["url_best"].encode()).decode()+".mp3"
			songs_info[0]["pic_url"] = "https://music.daoapp.io/ssl/"+base64.urlsafe_b64encode(songs_info[0]["pic_url"].encode()).decode()+".jpg"
		else:
			pass
		showlrc = qlrc
	elif program_id is not None:
		song_info = netease.netease_cloud_music("program",program_id,0)
		title = song_info["album"]
		songs_info = [song_info]
		showlrc = "0"
	elif radio_id is not None:
		songs_info = netease.netease_cloud_music("radio",radio_id,0)
		title = songs_info[0]["artist"]
		showlrc = "0"
	elif mv_id is not None:
		mv_info = netease.netease_cloud_music("mv",mv_id,0)
		mv_url = mv_info["url_best"]
		title = mv_info["title"]
		pic_url = mv_info["pic_url"]
		return render_template("dplayer_iframe.html",mv_url=mv_url,title=title,mv_id=mv_id,pic_url=pic_url,max_width=max_width)
	else:
		abort(404)

	return render_template("aplayer_iframe.html",songs_info=songs_info,title=title,showlrc=showlrc,qnarrow=qnarrow,max_width=max_width,song_id=song_id,autoplay=autoplay)
示例#4
0
def iframe():
    album_id = request.args.get("album")
    playlist_id = request.args.get("playlist")
    song_id = request.args.get("song")
    program_id = request.args.get("program")
    radio_id = request.args.get("radio")
    mv_id = request.args.get("mv")

    qssl = request.args.get("qssl")
    qlrc = request.args.get("qlrc")
    qnarrow = request.args.get("qnarrow")
    max_width = request.args.get("max_width")
    autoplay = request.args.get("autoplay")
    height = request.args.get("height")
    color = request.args.get("color")

    if qnarrow is None:
        qnarrow = "false"
    else:
        pass

    if qlrc is None:
        qlrc = "0"
    else:
        pass

    if max_width is None:
        max_width = "100%"
    else:
        pass

    if color is None:
        color = "#42b983"
    else:
        pass

    if height is None:
        height = "20em"
    else:
        pass

    if autoplay is None:
        autoplay = "true"
    else:
        pass
    if album_id is not None:
        album_info = netease.netease_cloud_music("album", album_id, qlrc)
        songs_info = album_info["songs_info"]
        title = "%s - %s" % (album_info["album"], album_info["artist"])
        showlrc = qlrc
    elif playlist_id is not None:
        playlist_info = netease.netease_cloud_music("playlist", playlist_id,
                                                    qlrc)
        songs_info = playlist_info["songs_info"]
        title = playlist_info["playlist"]
        showlrc = qlrc
    elif song_id is not None:
        song_info = netease.netease_cloud_music("song", song_id, qlrc)
        title = "%s - %s" % (song_info["title"], song_info["artist"])
        songs_info = [song_info]
        if qssl == "1":
            songs_info[0][
                "url_best"] = "https://music.daoapp.io/ssl/" + base64.urlsafe_b64encode(
                    songs_info[0]["url_best"].encode()).decode() + ".mp3"
            songs_info[0][
                "pic_url"] = "https://music.daoapp.io/ssl/" + base64.urlsafe_b64encode(
                    songs_info[0]["pic_url"].encode()).decode() + ".jpg"
        else:
            pass
        showlrc = qlrc
    elif program_id is not None:
        song_info = netease.netease_cloud_music("program", program_id, 0)
        title = song_info["album"]
        songs_info = [song_info]
        showlrc = "0"
    elif radio_id is not None:
        songs_info = netease.netease_cloud_music("radio", radio_id, 0)
        title = songs_info[0]["artist"]
        showlrc = "0"
    elif mv_id is not None:
        mv_info = netease.netease_cloud_music("mv", mv_id, 0)
        mv_url = mv_info["url_best"]
        title = mv_info["title"]
        pic_url = mv_info["pic_url"]
        return render_template("dplayer_iframe.html",
                               mv_url=mv_url,
                               title=title,
                               mv_id=mv_id,
                               pic_url=pic_url,
                               max_width=max_width)
    else:
        abort(404)

    return render_template("aplayer_iframe.html",
                           songs_info=songs_info,
                           title=title,
                           showlrc=showlrc,
                           qnarrow=qnarrow,
                           max_width=max_width,
                           song_id=song_id,
                           autoplay=autoplay,
                           height=height,
                           color=color)
示例#5
0
文件: app.py 项目: imfht/flaskapp1
def iframe():
    album_id = request.args.get("album")
    playlist_id = request.args.get("playlist")
    song_id = request.args.get("song")
    program_id = request.args.get("program")
    radio_id = request.args.get("radio")
    mv_id = request.args.get("mv")

    qssl = request.args.get("qssl")
    qlrc = request.args.get("qlrc")
    qnarrow = request.args.get("qnarrow")
    max_width = request.args.get("max_width")
    max_height = request.args.get("max_height")
    mode = request.args.get("mode")
    autoplay = request.args.get("autoplay")

    if qnarrow is None:
        qnarrow = "false"
    else:
        pass
    if qlrc is None:
        qlrc = "0"
    else:
        pass
    if max_width is None:
        max_width = "100%"
    else:
        pass
    if mode is None:
        mode = "circulation"
    else:
        pass
    if autoplay is None:
        autoplay = "true"
    else:
        pass
    if album_id is not None:
        album_info = netease.netease_cloud_music("album", album_id, 0)
        songs_info = album_info["songs_info"]
        if qssl == "1":
            for i in range(len(songs_info)):
                songs_info[i]["url_best"] = songs_info[i]["url_best"].replace(
                    'http', 'https')
                songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace(
                    'http', 'https')
        else:
            pass
        title = "%s - %s" % (album_info["album"], album_info["artist"])
        showlrc = "0"
    elif playlist_id is not None:
        playlist_info = netease.netease_cloud_music("playlist", playlist_id, 0)
        songs_info = playlist_info["songs_info"]
        if qssl == "1":
            for i in range(len(songs_info)):
                songs_info[i]["url_best"] = songs_info[i]["url_best"].replace(
                    'http', 'https')
                songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace(
                    'http', 'https')
        else:
            pass
        title = playlist_info["playlist"]
        showlrc = "0"
    elif song_id is not None:
        song_info = netease.netease_cloud_music("song", song_id, 1)
        title = "%s - %s" % (song_info["title"], song_info["artist"])
        songs_info = [song_info]
        if qssl == "1":
            songs_info[0]["url_best"] = songs_info[0]["url_best"].replace(
                'http', 'https')
            songs_info[0]["pic_url"] = songs_info[0]["pic_url"].replace(
                'http', 'https')
        else:
            pass
        showlrc = qlrc
    elif program_id is not None:
        song_info = netease.netease_cloud_music("program", program_id, 0)
        title = song_info["album"]
        songs_info = [song_info]
        if qssl == "1":
            for i in range(len(songs_info)):
                songs_info[i]["url_best"] = songs_info[i]["url_best"].replace(
                    'http', 'https')
                songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace(
                    'http', 'https')
        else:
            pass
        showlrc = "0"
    elif radio_id is not None:
        songs_info = netease.netease_cloud_music("radio", radio_id, 0)
        title = songs_info[0]["artist"]
        if qssl == "1":
            for i in range(len(songs_info)):
                songs_info[i]["url_best"] = songs_info[i]["url_best"].replace(
                    'http', 'https')
                songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace(
                    'http', 'https')
        else:
            pass
        showlrc = "0"
    elif mv_id is not None:
        mv_info = netease.netease_cloud_music("mv", mv_id, 0)
        mv_url = mv_info["url_best"]
        title = mv_info["title"]
        pic_url = mv_info["pic_url"]
        return render_template("dplayer_iframe.html",
                               mv_url=mv_url,
                               title=title,
                               mv_id=mv_id,
                               pic_url=pic_url,
                               max_width=max_width,
                               autoplay=autoplay)
    else:
        abort(404)

    return render_template("aplayer_iframe.html",
                           songs_info=songs_info,
                           title=title,
                           showlrc=showlrc,
                           qnarrow=qnarrow,
                           max_width=max_width,
                           max_height=max_height,
                           song_id=song_id,
                           autoplay=autoplay,
                           mode=mode)
def iframe():
	album_id = request.args.get("album")
	playlist_id = request.args.get("playlist")
	song_id = request.args.get("song")
	program_id = request.args.get("program")
	radio_id = request.args.get("radio")
	mv_id = request.args.get("mv")

	qssl = request.args.get("qssl")
	qlrc = request.args.get("qlrc")
	qnarrow = request.args.get("qnarrow")
	max_width = request.args.get("max_width")
	max_height = request.args.get("max_height")
	mode = request.args.get("mode")
	autoplay = request.args.get("autoplay")
	
	if qnarrow is None:
		qnarrow = "false"
	else:
		pass
	if qlrc is None:
		qlrc = "0"
	else:
		pass
	if max_width is None:
		max_width = "100%"
	else:
		pass
	if mode is None:
		mode = "circulation"
	else:
		pass	
	if autoplay is None:
		autoplay = "true"
	else:
		pass
	if album_id is not None:
		album_info = netease.netease_cloud_music("album",album_id,0)
		songs_info = album_info["songs_info"]
		if qssl == "1":
			for i in range(len(songs_info)):
				songs_info[i]["url_best"] = songs_info[i]["url_best"].replace('http', 'https')
				songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace('http', 'https')
		else:
			pass
		title = "%s - %s" %(album_info["album"],album_info["artist"])
		showlrc = "0"
	elif playlist_id is not None:
		playlist_info = netease.netease_cloud_music("playlist",playlist_id,0)
		songs_info = playlist_info["songs_info"]
		if qssl == "1":
			for i in range(len(songs_info)):
				songs_info[i]["url_best"] = songs_info[i]["url_best"].replace('http', 'https')
				songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace('http', 'https')
		else:
			pass
		title = playlist_info["playlist"]
		showlrc = "0"
	elif song_id is not None:
		song_info = netease.netease_cloud_music("song",song_id,1)
		title = "%s - %s" %(song_info["title"],song_info["artist"])
		songs_info = [song_info]
		if qssl == "1":
			songs_info[0]["url_best"] = songs_info[0]["url_best"].replace('http', 'https')
			songs_info[0]["pic_url"] = songs_info[0]["pic_url"].replace('http', 'https')
		else:
			pass
		showlrc = qlrc
	elif program_id is not None:
		song_info = netease.netease_cloud_music("program",program_id,0)
		title = song_info["album"]
		songs_info = [song_info]
		if qssl == "1":
			for i in range(len(songs_info)):
				songs_info[i]["url_best"] = songs_info[i]["url_best"].replace('http', 'https')
				songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace('http', 'https')
		else:
			pass
		showlrc = "0"
	elif radio_id is not None:
		songs_info = netease.netease_cloud_music("radio",radio_id,0)
		title = songs_info[0]["artist"]
		if qssl == "1":
			for i in range(len(songs_info)):
				songs_info[i]["url_best"] = songs_info[i]["url_best"].replace('http', 'https')
				songs_info[i]["pic_url"] = songs_info[i]["pic_url"].replace('http', 'https')
		else:
			pass
		showlrc = "0"
	elif mv_id is not None:
		mv_info = netease.netease_cloud_music("mv",mv_id,0)
		mv_url = mv_info["url_best"]
		title = mv_info["title"]
		pic_url = mv_info["pic_url"]
		return render_template("dplayer_iframe.html",mv_url=mv_url,title=title,mv_id=mv_id,pic_url=pic_url,max_width=max_width,autoplay=autoplay)
	else:
		abort(404)

	return render_template("aplayer_iframe.html",songs_info=songs_info,title=title,showlrc=showlrc,qnarrow=qnarrow,max_width=max_width,max_height=max_height,song_id=song_id,autoplay=autoplay,mode=mode)