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


Python Net.async_call方法代码示例

本文整理汇总了Python中kuwo.Net.async_call方法的典型用法代码示例。如果您正苦于以下问题:Python Net.async_call方法的具体用法?Python Net.async_call怎么用?Python Net.async_call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kuwo.Net的用法示例。


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

示例1: show_sub2

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def show_sub2(self, init=False):
        def _show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if nodes is None or self.sub2_total == 0:
                return
            i = len(self.liststore_sub2)
            for node in nodes:
                self.liststore_sub2.append([self.app.theme['anonymous'],
                    Widgets.unescape_html(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape_html(node['info']), ])
                Net.update_liststore_image(self.liststore_sub2, i, 0, 
                        node['pic'])
                i += 1
            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()

        if init:
            self.scrolled_sub1.hide()
            self.button_sub1.show_all()
            self.scrolled_sub2.get_vadjustment().set_value(0)
            self.scrolled_sub2.show_all()
            self.sub2_page = 0
            self.liststore_sub2.clear()
        Net.async_call(Net.get_nodes, _show_sub2,
                self.curr_sub2_id, self.sub2_page)
开发者ID:iiccn,项目名称:kwplayer,代码行数:29,代码来源:TopCategories.py

示例2: _on_show_sub1

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
        def _on_show_sub1(info, error=None):
            if not info or not info[0] or not info[1] or error:
                logger.error('show_sub1(): %s, %s' % (info, error))
                return
            nodes, self.sub1_total = info
            urls = []
            tree_iters = []
            for node in nodes:
                id_ = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    tooltip = Widgets.set_tooltip_with_song_tips(node['name'],
                                                                 node['tips'])
                else:
                    tooltip = Widgets.set_tooltip(node['name'], node['info'])
                tree_iter = self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[id_]),
                    Widgets.unescape(node['info']),
                    tooltip,
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub1, 0,
                           tree_iters, urls)

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
开发者ID:Holdlen2DH,项目名称:kwplayer,代码行数:31,代码来源:TopCategories.py

示例3: append_artist_albums

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_artist_albums(self, init=False):
        def _append_artist_albums(albums_args, error=None):
            albums, self.artist_albums_total = albums_args
            if self.artist_albums_total == 0:
                return
            i = len(self.artist_albums_liststore)
            for album in albums:
                if len(album['info']) == 0:
                    tooltip = Widgets.tooltip(album['name'])
                else:
                    tooltip = '<b>{0}</b>\n{1}'.format(
                            Widgets.tooltip(album['name']),
                            Widgets.tooltip(album['info']))
                self.artist_albums_liststore.append([
                    self.app.theme['anonymous'], album['name'],
                    int(album['albumid']), album['artist'],
                    int(album['artistid']), tooltip, ])
                Net.update_album_covers(self.artist_albums_liststore, i,
                        0, album['pic'])
                i += 1
            self.artist_albums_page += 1
            if self.artist_albums_page < self.artist_albums_total - 1:
                self.append_artist_albums()

        if init:
            self.artist_albums_liststore.clear()
            self.artist_albums_page = 0
        Net.async_call(Net.get_artist_albums, _append_artist_albums,
                self.curr_artist_id, self.artist_albums_page)
开发者ID:weakish,项目名称:kwplayer,代码行数:31,代码来源:Artists.py

示例4: append_songs

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_songs(self, init=False):
        def _append_songs(songs_args, error=None):
            songs, self.songs_total = songs_args
            if self.songs_total == 0:
                return
            i = len(self.liststore_songs)
            for song in songs:
                self.liststore_songs.append([
                    self.app.theme['anonymous'],
                    song['name'],
                    song['artist'],
                    song['album'],
                    int(song['id']),
                    int(song['artistid']), 
                    int(song['albumid']),
                    Widgets.set_tooltip(song['name'], song['artist']),
                    ])
                Net.update_mv_image(self.liststore_songs, i, 0,
                        song['mvpic'])
                i += 1
            self.songs_page += 1
            if self.songs_page < self.songs_total - 1:
                self.append_songs()

        if init:
            self.app.playlist.advise_new_playlist_name(
                    self.label.get_text())
            self.songs_page = 0
            self.liststore_songs.clear()
        Net.async_call(Net.get_mv_songs, _append_songs, 
                self.curr_node_id, self.songs_page)
开发者ID:anchowee,项目名称:kwplayer,代码行数:33,代码来源:MV.py

示例5: show_artists

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def show_artists(self, reset_status=False):
        def _append_artists(artists_args, error=None):
            artists, hit, self.artists_total = artists_args
            if hit == 0:
                if reset_status:
                    self.artists_button.set_label(
                            '{0} (0)'.format(_('Artists')))
                return
            self.artists_button.set_label(
                    '{0} ({1})'.format(_('Artists'), hit))
            i = len(self.liststore_artists)
            for artist in artists:
                self.liststore_artists.append([self.app.theme['anonymous'],
                    artist['ARTIST'],
                    int(artist['ARTISTID']), 
                    artist['COUNTRY'], ])
                Net.update_artist_logo(self.liststore_artists, i, 0,
                        artist['PICPATH'])
                i += 1

        keyword = self.search_entry.get_text()
        if len(keyword) == 0:
            return
        if reset_status:
            self.liststore_artists.clear()
        Net.async_call(Net.search_artists, _append_artists,
                keyword, self.artists_page)
开发者ID:dissipator,项目名称:kwplayer,代码行数:29,代码来源:Search.py

示例6: append_artist_info

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_artist_info(self):
        def _append_artist_info(info, error=None):
            if error or not info:
                logger.error('appen_artist_info(): %s, %s' % (info, error))
                return
            if info.get('pic', None):
                self.artist_info_pic.set_from_file(info['pic'])
            self.artist_info_name.set(info, 'name')
            self.artist_info_birthday.set(info, 'birthday')
            self.artist_info_birthplace.set(info, 'birthplace')
            self.artist_info_height.set(info, 'tall')
            self.artist_info_weight.set(info, 'weight',)
            self.artist_info_country.set(info, 'country')
            self.artist_info_language.set(info, 'language')
            self.artist_info_gender.set(info, 'gender',)
            self.artist_info_constellation.set(info, 'constellation')
            if info and 'info' in info:
                if html2text_imported:
                    self.artist_info_textbuffer.set_text(
                            html2text.html2text(info['info']))
                else:
                    self.artist_info_textbuffer.set_text(
                            Widgets.escape(info['info']))
            else:
                self.artist_info_textbuffer.set_text('')

        Net.async_call(Net.get_artist_info, self.curr_artist_id,
                       callback=_append_artist_info)
开发者ID:Jonham,项目名称:kwplayer,代码行数:30,代码来源:Artists.py

示例7: get_mv_link

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
 def get_mv_link(self):
     def _update_mv_link(mv_args, error=None):
         mv_link, mv_path = mv_args
         self.show_mv_btn.set_sensitive(mv_link is not False)
     Net.async_call(
             Net.get_song_link, _update_mv_link,
             self.curr_song, self.app.conf, True)
开发者ID:curnuz,项目名称:kwplayer,代码行数:9,代码来源:Player.py

示例8: append_artist_similar

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_artist_similar(self, init=False):
        self.first()
        def _append_artist_similar(similar_args, error=None):
            artists, self.artist_similar_total = similar_args
            if error or not self.artist_similar_total:
                return
            urls = []
            tree_iters = []
            for artist in artists:
                _info = ''.join([artist['songnum'], _(' songs'), ])
                tree_iter = self.artist_similar_liststore.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(artist['name']),
                    int(artist['id']),
                    _info,
                    Widgets.set_tooltip(artist['name'], _info),
                    ])
                urls.append(artist['pic'])
                tree_iters.append(tree_iter)
            Net.update_artist_logos(
                    self.artist_similar_liststore, 0, tree_iters, urls)
            self.artist_similar_page += 1
            if self.artist_similar_page < self.artist_similar_total - 1:
                self.append_artist_similar()

        if init:
            self.artist_similar_liststore.clear()
            self.artist_similar_page = 0
        if init or not hasattr(self.artist_similar_liststore, 'timestamp'):
            self.artist_similar_liststore.timestamp = time.time()
        Net.async_call(
                Net.get_artist_similar, _append_artist_similar,
                self.curr_artist_id, self.artist_similar_page)
开发者ID:Taliens,项目名称:kwplayer,代码行数:35,代码来源:Artists.py

示例9: get_lrc

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def get_lrc(self):
        def _update_lrc(lrc_text, error=None):
            if error:
                logger.error('get_lrc(): %s', error)
            self.app.lrc.set_lrc(lrc_text)

        Net.async_call(Net.get_lrc, self.curr_song, callback=_update_lrc)
开发者ID:Match-Yang,项目名称:kwplayer,代码行数:9,代码来源:Player.py

示例10: append_artist_albums

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_artist_albums(self, init=False):
        def _append_artist_albums(albums_args, error=None):
            albums, self.artist_albums_total = albums_args
            if error or self.artist_albums_total == 0:
                return
            urls = []
            tree_iters = []
            for album in albums:
                tree_iter = self.artist_albums_liststore.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(album['name']),
                    int(album['albumid']),
                    Widgets.unescape(album['artist']),
                    int(album['artistid']),
                    Widgets.set_tooltip(album['name'], album['info']),
                    ])
                urls.append(album['pic'])
                tree_iters.append(tree_iter)
            Net.update_album_covers(
                    self.artist_albums_liststore, 0, tree_iters, urls)
            self.artist_albums_page += 1
            if self.artist_albums_page < self.artist_albums_total - 1:
                self.append_artist_albums()

        if init:
            self.artist_albums_liststore.clear()
            self.artist_albums_page = 0
        if init or not hasattr(self.artist_albums, 'timestamp'):
            self.artist_albums_liststore.timestamp = time.time()
        Net.async_call(
                Net.get_artist_albums, _append_artist_albums,
                self.curr_artist_id, self.artist_albums_page)
开发者ID:Taliens,项目名称:kwplayer,代码行数:34,代码来源:Artists.py

示例11: append_artist_mv

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_artist_mv(self, init=False):
        def _append_artist_mv(mv_args, error=None):
            mvs, self.artist_mv_total = mv_args
            if error or self.artist_mv_total == 0:
                return
            urls = []
            tree_iters = []
            for mv in mvs:
                tree_iter = self.artist_mv_liststore.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(mv['name']),
                    Widgets.unescape(mv['artist']),
                    '',
                    int(mv['musicid']),
                    int(mv['artistid']),
                    0,
                    Widgets.set_tooltip(mv['name'], mv['artist']),
                    ])
                tree_iters.append(tree_iter)
                urls.append(mv['pic'])
            Net.update_mv_images(
                    self.artist_mv_liststore, 0, tree_iters, urls)
            self.artist_mv_page += 1
            if self.artist_mv_page < self.artist_mv_total - 1:
                self.append_artist_mv()

        if init:
            self.artist_mv_liststore.clear()
            self.artist_mv_page = 0
        if init or not hasattr(self.artist_mv_liststore, 'timestamp'):
            self.artist_mv_liststore.timestamp = time.time()
        Net.async_call(
                Net.get_artist_mv, _append_artist_mv,
                self.curr_artist_id, self.artist_mv_page)
开发者ID:Taliens,项目名称:kwplayer,代码行数:36,代码来源:Artists.py

示例12: show_artists

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def show_artists(self, reset_status=False):
        def _append_artists(artists_args, error=None):
            artists, hit, self.artists_total = artists_args
            if (error or not hit) and reset_status:
                self.artists_button.set_label('{0} (0)'.format(_('Artists')))
                return
            self.artists_button.set_label(
                    '{0} ({1})'.format(_('Artists'), hit))
            urls = []
            tree_iters = []
            for artist in artists:
                tree_iter = self.liststore_artists.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(artist['ARTIST']),
                    int(artist['ARTISTID']), 
                    Widgets.unescape(artist['COUNTRY']),
                    ])
                tree_iters.append(tree_iter)
                urls.append(artist['PICPATH'])
            Net.update_artist_logos(
                    self.liststore_artists, 0, tree_iters, urls)

        keyword = self.search_entry.get_text()
        if not keyword:
            return
        if reset_status:
            self.liststore_artists.clear()
        if reset_status or not hasattr(self.liststore_artists, 'timestamp'):
            self.liststore_artists.timestamp = time.time()
        Net.async_call(
                Net.search_artists, _append_artists,
                keyword,self.artists_page)
开发者ID:Taliens,项目名称:kwplayer,代码行数:34,代码来源:Search.py

示例13: show_albums

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def show_albums(self):
        def _append_albums(albums_args, error=None):
            albums, hit, self.albums_total = albums_args
            if not error and albums and hit:
                urls,tree_iters = [], []
                for album in albums:
                    tooltip = Widgets.escape(album.get('info',
                                             album['name']))
                    tree_iter = self.liststore_albums.append([
                        Config.ANONYMOUS_PIXBUF,
                        Widgets.unescape(album['name']),
                        int(album['albumid']),
                        Widgets.unescape(album['artist']),
                        int(album['artistid']),
                        tooltip,
                    ])
                    tree_iters.append(tree_iter)
                    urls.append(album['pic'])
                Net.async_call(Net.update_album_covers, self.liststore_albums,
                               0, tree_iters, urls)
            else:
                logger.error('show_albums: %s, %s' % (self.albums_total, error))

            self.albums_button.set_label('{0} ({1})'.format(_('Albums'),
                                         len(self.liststore_albums)))

        if self.albums_page == 0:
            self.liststore_albums.timestamp = time.time()
        Net.async_call(Net.search_albums, self.keyword, self.albums_page,
                       callback=_append_albums)
开发者ID:Jonham,项目名称:kwplayer,代码行数:32,代码来源:Search.py

示例14: show_artists

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def show_artists(self):
        def _append_artists(artists_args, error=None):
            artists, hit, self.artists_total = artists_args
            if not error and artists and hit:
                urls, tree_iters = [], []
                for artist in artists:
                    tree_iter = self.liststore_artists.append([
                        Config.ANONYMOUS_PIXBUF,
                        Widgets.unescape(artist['ARTIST']),
                        int(artist['ARTISTID']),
                        Widgets.unescape(artist['COUNTRY']),
                    ])
                    tree_iters.append(tree_iter)
                    urls.append(artist['PICPATH'])
                Net.async_call(Net.update_artist_logos, self.liststore_artists,
                               0, tree_iters, urls)
            else:
                logger.error('show_artists(): %s, %s' %
                             (self.artists_total, error))

            self.artists_button.set_label('{0} ({1})'.format(_('Artists'),
                                          len(self.liststore_artists)))

        # timestamp is used to mark Liststore ID
        if self.artists_page == 0:
            self.liststore_artists.timestamp = time.time()
        Net.async_call(Net.search_artists, self.keyword, self.artists_page,
                       callback=_append_artists)
开发者ID:Jonham,项目名称:kwplayer,代码行数:30,代码来源:Search.py

示例15: append_artist_albums

# 需要导入模块: from kuwo import Net [as 别名]
# 或者: from kuwo.Net import async_call [as 别名]
    def append_artist_albums(self, init=False):
        def _append_artist_albums(albums_args, error=None):
            albums, self.artist_albums_total = albums_args
            if error or self.artist_albums_total == 0:
                logger.error('append_arttist_albums(): %s, %s' %
                             (self.artist_albums_taotal, error))
                return
            urls = []
            tree_iters = []
            for album in albums:
                tree_iter = self.artist_albums_liststore.append([
                    Config.ANONYMOUS_PIXBUF,
                    Widgets.unescape(album['name']),
                    int(album['albumid']),
                    Widgets.unescape(album['artist']),
                    int(album['artistid']),
                    Widgets.set_tooltip(album['name'], album['info']),
                ])
                urls.append(album['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_album_covers,
                           self.artist_albums_liststore, 0, tree_iters, urls)
            self.artist_albums_page += 1
            if self.artist_albums_page < self.artist_albums_total - 1:
                self.append_artist_albums()

        if init:
            self.artist_albums_tab.get_vscrollbar().set_value(0)
            self.artist_albums_liststore.clear()
            self.artist_albums_page = 0
        if init or not hasattr(self.artist_albums, 'timestamp'):
            self.artist_albums_liststore.timestamp = time.time()
        Net.async_call(Net.get_artist_albums, self.curr_artist_id,
                       self.artist_albums_page, callback=_append_artist_albums)
开发者ID:Jonham,项目名称:kwplayer,代码行数:36,代码来源:Artists.py


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