コード例 #1
0
ファイル: view.py プロジェクト: iamzcr/net_music
def play_list():
    cate = '全部'
    if request.method == "POST":
        cate = request.form['cate']
    play_song_list = NetEase.top_playlists(NetEase(),cate)
    categoty = NetEase.get_play_category(NetEase(),play_song_list)
    return render_template('play_list.html',play_song_list = play_song_list,categoty = categoty,now_cate=cate)
コード例 #2
0
def getTop_playlistsId(request):
    getlistAll = []
    global getLists
    getLists = []
    global getListName
    getListName = []
    global getListImage
    getListImage = []

    getDict = {}
    #getDict.
    ease = NetEase()
    s = ease.top_playlists(limit=50)
    req = simplejson.dumps(s)
    getReq = simplejson.loads(req)
    print(getReq)
    # req = simplejson.loads(s)
    # 遍历整个字典取出需要的数据并加入到list
    for getid in getReq:
        global getLists
        getLists.append(getid["id"])
        global getListName
        getListName.append(getid["name"])
        global getListImage
        getListImage.append(getid["coverImgUrl"])

    getlistAll.append(getLists)
    getlistAll.append(getListName)
    getlistAll.append(getListImage)

    jsonArray = simplejson.dumps(getlistAll)

    return HttpResponse(jsonArray)
コード例 #3
0
ファイル: views.py プロジェクト: Peterpig/MusicServer
def getTop_playlistsId(request):
    getlistAll = []
    global getLists
    getLists = []
    global getListName
    getListName = []
    global getListImage
    getListImage = []

    getDict = {}
    #getDict.
    ease = NetEase()
    s = ease.top_playlists(limit=50)
    req = simplejson.dumps(s)
    getReq = simplejson.loads(req)
    print(getReq)
   # req = simplejson.loads(s)
    # 遍历整个字典取出需要的数据并加入到list
    for getid in getReq:
        global getLists
        getLists.append(getid["id"])
        global getListName
        getListName.append(getid["name"])
        global getListImage
        getListImage.append(getid["coverImgUrl"])

    getlistAll.append(getLists)
    getlistAll.append(getListName)
    getlistAll.append(getListImage)

    jsonArray = simplejson.dumps(getlistAll)


    return HttpResponse(jsonArray)
コード例 #4
0
def top_playlists():
    ne = NetEase()
    json_str = ne.top_playlists()
    return json.dumps(json_str)