当前位置: 首页>>代码示例>>Python>>正文


Python api.NetEase类代码示例

本文整理汇总了Python中api.NetEase的典型用法代码示例。如果您正苦于以下问题:Python NetEase类的具体用法?Python NetEase怎么用?Python NetEase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NetEase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: play_list

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)
开发者ID:iamzcr,项目名称:net_music,代码行数:7,代码来源:view.py

示例2: getTop_playlistsId

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)
开发者ID:Peterpig,项目名称:MusicServer,代码行数:34,代码来源:views.py

示例3: getPlayListDetail

def getPlayListDetail(request):
    sendJsonAll = []
    global getSongIDs
    getSongIDs = []
    getSongTimes = []
    getSongNames = []
    getSongMp3Url = []
    getId = simplejson.loads(request.body)
    print(getId)
    id = getId["id"]
    ease = NetEase()
    s = ease.playlist_detail(id)
    jsonData = simplejson.dumps(s)
    parjson = simplejson.loads(jsonData)

    print(parjson)

    for getKeys in parjson:
        global getSongIDs
        getSongIDs.append(getKeys["id"])

        getSongNames.append(getKeys["name"])
        getSongTimes.append(getKeys["duration"])
        getSongMp3Url.append(getKeys["mp3Url"])

    sendJsonAll.append(getSongIDs)
    sendJsonAll.append(getSongNames)
    sendJsonAll.append(getSongTimes)
    sendJsonAll.append(getSongMp3Url)
    global getSongIDs
    sendJsonData = simplejson.dumps(sendJsonAll)
    print(sendJsonData)
    return HttpResponse(sendJsonData)
开发者ID:Peterpig,项目名称:MusicServer,代码行数:33,代码来源:views.py

示例4: search_music

def search_music(q, limit):
	netease = NetEase()
	r = netease.search(q, limit=limit)
	if r['code'] != 200:
		return jsonify({
			"error"		:	True
			})
	else:
		ids = []
		for song in r['result']['songs']:
			ids.append(song['id'])
		musics = netease.songs_detail(ids)
		outputs = []
		for music in musics:
			outputs.append({
				"error"	:	False,
				"name"	:	music['name'],
				"cover"	:	music['album']['blurPicUrl'],
				"album_name":	music['album']['name'],
				"author": 	music['artists'][0]['name'],
				"url"	:	music['mp3Url']
				})
		outputs = {
			"error"		:	False,
			"type"		:	"music",
			"musics"	:	outputs
		}
		return jsonify(outputs)
开发者ID:343829084,项目名称:NetEase-MusicBox,代码行数:28,代码来源:index.py

示例5: get_song_infos

def get_song_infos():
       n = NetEase()
       songlist = []
       for i in n.top_songlist():
              singers = ""
              for t in[j['name'] for j in i['artists']]:
                     singers = singers+" "+t
              
              songlist.append([i['name'],singers,i['mp3Url']])
       return songlist
开发者ID:sinnuswong,项目名称:weixinfanyi,代码行数:10,代码来源:views.py

示例6: getLyric

 def getLyric():
     if 'lyric' not in self.songs[str(self.playing_id)].keys():
         self.songs[str(self.playing_id)]["lyric"] = []
     if len(self.songs[str(self.playing_id)]["lyric"]) > 0:
         return
     netease = NetEase()
     lyric = netease.song_lyric(self.playing_id)
     if (not lyric == []) or lyric == '未找到歌词':
         lyric = lyric.split('\n')
     self.songs[str(self.playing_id)]["lyric"] = lyric
     return
开发者ID:sinnuswong,项目名称:musicbox,代码行数:11,代码来源:player.py

示例7: getLyric

 def getLyric():
     if "lyric" not in self.songs[str(self.playing_id)].keys():
         self.songs[str(self.playing_id)]["lyric"] = []
     if len(self.songs[str(self.playing_id)]["lyric"]) > 0:
         return
     netease = NetEase()
     lyric = netease.song_lyric(self.playing_id)
     if lyric == [] or lyric == "未找到歌词":
         return
     lyric = lyric.split("\n")
     self.songs[str(self.playing_id)]["lyric"] = lyric
     return
开发者ID:Sam0523,项目名称:musicbox,代码行数:12,代码来源:player.py

示例8: gettLyric

 def gettLyric():
     if 'tlyric' not in self.songs[str(self.playing_id)].keys():
         self.songs[str(self.playing_id)]["tlyric"] = []
     if len(self.songs[str(self.playing_id)]["tlyric"]) > 0:
         return
     netease = NetEase()
     tlyric = netease.song_tlyric(self.playing_id)
     if tlyric == [] or tlyric == '未找到歌词翻译':
         return
     tlyric = tlyric.split('\n')
     self.songs[str(self.playing_id)]["tlyric"] = tlyric
     return
开发者ID:KindleCode,项目名称:musicbox,代码行数:12,代码来源:player.py

示例9: __init__

    def __init__(self, song_name):
        self.mp3_date = None
        netease = NetEase()
        data = netease.search(song_name, stype=1, offset=0, total='true', limit=60)
#        print data
        song_ids = []
        if 'songs' in data['result']:
            if 'mp3Url' in data['result']['songs']:
                songs = data['result']['songs']

            else:
                for i in range(0, len(data['result']['songs']) ):
                    song_ids.append( data['result']['songs'][i]['id'] )
                songs = netease.songs_detail(song_ids)
        self.mp3_data = netease.dig_info(songs, 'songs')   #歌曲信息,album, artist, song_name, mp3_url
开发者ID:frank-dkvan,项目名称:RasWxMusicbox,代码行数:15,代码来源:netease.py

示例10: __init__

 def __init__(self):
     reload(sys)
     sys.setdefaultencoding('UTF-8')
     self.config = Config()
     self.datatype = 'main'
     self.title = 'NetEase Music'
     self.datalist = ['Charts', 'Artists', 'New Songs', 'Songs', 'My Songs', 'Radio Stations', 'Recommended',
                      'Personal Radio', 'Search', 'Help']
     self.offset = 0
     self.index = 0
     self.storage = Storage()
     self.storage.load()
     self.collection = self.storage.database['collections'][0]
     self.player = Player()
     self.player.playing_song_changed_callback = self.song_changed_callback
     self.cache = Cache()
     self.ui = Ui()
     self.netease = NetEase()
     self.screen = curses.initscr()
     self.screen.keypad(1)
     self.step = 10
     self.stack = []
     self.djstack = []
     self.userid = self.storage.database['user']['user_id']
     self.username = self.storage.database['user']['nickname']
     self.resume_play = True
     self.at_playing_list = False
     signal.signal(signal.SIGWINCH, self.change_term)
     signal.signal(signal.SIGINT, self.send_kill)
     self.START = time.time()
开发者ID:Zorgodon,项目名称:musicbox,代码行数:30,代码来源:menu.py

示例11: search

def search():
    if request.method == "GET":
        s = request.args.get('s')
        search_list = NetEase.get_search(NetEase(),s)
        return render_template('search.html',search_list = search_list['result']['songs'])
    else:
        return render_template('search.html',search_list = None)
开发者ID:iamzcr,项目名称:net_music,代码行数:7,代码来源:view.py

示例12: __init__

    def __init__(self):
        self.screen = curses.initscr()
        self.screen.timeout(100)  # the screen refresh every 100ms
        # charactor break buffer
        curses.cbreak()
        self.screen.keypad(1)
        self.netease = NetEase()

        curses.start_color()
        curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        # term resize handling
        size = terminalsize.get_terminal_size()
        self.x = max(size[0], 10)
        self.y = max(size[1], 25)
        self.startcol = int(float(self.x) / 5)
        self.indented_startcol = max(self.startcol - 3, 0)
        self.update_space()
        self.lyric = ''
        self.now_lyric = ''
        self.tlyric = ''
        self.storage = Storage()
        self.config = Config()
        self.newversion = False
开发者ID:Zorgodon,项目名称:musicbox,代码行数:26,代码来源:ui.py

示例13: __init__

    def __init__(self):
        self.screen = curses.initscr()
        self.screen.timeout(100)  # the screen refresh every 100ms
        # charactor break buffer
        curses.cbreak()
        self.screen.keypad(1)
        self.netease = NetEase()

        curses.start_color()
        curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        # term resize handling
        size = terminalsize.get_terminal_size()
        self.x = max(size[0], 10)
        self.y = max(size[1], 25)
        self.startcol = int(float(self.x) / 5)
        self.indented_startcol = max(self.startcol - 3, 0)
        self.update_space()
        self.lyric = ""
        self.now_lyric = ""
        self.storage = Storage()
        self.newversion = False

        # Set cursor to invisible.
        try:
            curses.curs_set(0)
        except curses.error:
            # The terminal does not supports the visibility requested.
            pass
开发者ID:royaso,项目名称:musicbox,代码行数:31,代码来源:ui.py

示例14: __init__

 def __init__(self):
     reload(sys)
     sys.setdefaultencoding('UTF-8')
     self.config = Config()
     self.datatype = 'main'
     self.title = '网易云音乐'
     self.datalist = ['排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '每日推荐', '私人FM', '搜索', '帮助']
     self.offset = 0
     self.index = 0
     self.storage = Storage()
     self.storage.load()
     self.collection = self.storage.database['collections'][0]
     self.player = Player()
     self.player.playing_song_changed_callback = self.song_changed_callback
     self.cache = Cache()
     self.ui = Ui()
     self.netease = NetEase()
     self.screen = curses.initscr()
     self.screen.keypad(1)
     self.step = 10
     self.stack = []
     self.djstack = []
     self.userid = self.storage.database["user"]["user_id"]
     self.username = self.storage.database["user"]["nickname"]
     self.resume_play = True
     self.at_playing_list = False
     signal.signal(signal.SIGWINCH, self.change_term)
     signal.signal(signal.SIGINT, self.send_kill)
     self.START = time.time()
开发者ID:dssljt,项目名称:musicbox,代码行数:29,代码来源:menu.py

示例15: User

class User(object):
    def __init__(self):
        self.netease = NetEase()
        self.is_login = False
        self.uid = str()    # ''

    def login(self, username, password):
        data = self.netease.login(username, password)
        code = data['code']
        if code is 200:
            self.uid = data['profile']['userId']
            self.is_login = True
            return True
        else:   # 501
            return False

    def get_favorite_playlist_id(self):
        """
        login required
        success: return playlist id
        fail: return empty string ''
        """
        if self.is_login:
            playlist = self.netease.user_playlist(self.uid)
            for each in playlist:
                if each['specialType'] is 5:    # favorite playlist
                    return each['id']   # the favorite playlist id
            return ''
        return ''

    def get_music_title_and_url(self, pid):
        """
        :param pid: playlist id
        :return re: return list re
        """
        playlist = self.netease.playlist_detail(pid)
        re = list()
        if playlist is not []:
            for music in playlist:
                tmp = dict()
                tmp['title'] = music['name']
                tmp['url'] = music['mp3Url']
                re.append(tmp)
        return re
开发者ID:wangqin4377,项目名称:NetEaseMusic,代码行数:44,代码来源:higherapi.py


注:本文中的api.NetEase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。