コード例 #1
0
ファイル: MV.py プロジェクト: Taliens/kwplayer
    def first(self):
        app = self.app
        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)
        button_home = Gtk.Button(_('MV'))
        button_home.connect('clicked', self.on_button_home_clicked)
        self.buttonbox.pack_start(button_home, False, False, 0)
        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # pic, name, artist, album, rid, artistid, albumid, tooltip
        self.liststore_songs = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, str, str, int, int, int, str)
        self.mv_control_box = Widgets.MVControlBox(
                self.liststore_songs, self.app)
        self.buttonbox.pack_end(self.mv_control_box, False, False, 0)

        self.scrolled_nodes = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_nodes, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_nodes = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_nodes = Widgets.IconView(self.liststore_nodes, tooltip=4)
        iconview_nodes.connect(
                'item_activated', self.on_iconview_nodes_item_activated)
        self.scrolled_nodes.add(iconview_nodes)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        iconview_songs = Widgets.IconView(
                self.liststore_songs, info_pos=2, tooltip=7)
        iconview_songs.connect(
                'item_activated', self.on_iconview_songs_item_activated)
        self.scrolled_songs.add(iconview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_songs.hide()

        nid = 3
        nodes_wrap = Net.get_index_nodes(nid)
        if not nodes_wrap:
            return
        nodes = nodes_wrap['child']
        self.liststore_nodes.clear()
        urls = []
        tree_iters = []
        for node in nodes:
            tree_iter = self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['disname']),
                int(node['sourceid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['disname'], node['info']),
                ])
            tree_iters.append(tree_iter)
            urls.append(node['pic'])
        self.liststore_nodes.timestamp = time.time()
        Net.update_liststore_images(
                self.liststore_nodes, 0, tree_iters, urls)
コード例 #2
0
ファイル: TopCategories.py プロジェクト: zihua/kwplayer
        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([
                    Config.ANONYMOUS_PIXBUF,
                    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()
コード例 #3
0
ファイル: TopCategories.py プロジェクト: zihua/kwplayer
        def _on_show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if error or not nodes or not self.sub2_total:
                logger.error('nodes: %s, self.sub2_total: %s, error: %s' %
                             (nodes, self.sub2_total, error))
                return
            urls = []
            tree_iters = []
            for node in nodes:
                tree_iter = self.liststore_sub2.append([
                    Config.ANONYMOUS_PIXBUF,
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(node['name'],
                                                       node['tips'])
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub2, 0,
                           tree_iters, urls)

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
コード例 #4
0
    def first(self):
        app = self.app
        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)
        button_home = Gtk.Button(_('MV'))
        button_home.connect('clicked', self.on_button_home_clicked)
        self.buttonbox.pack_start(button_home, False, False, 0)
        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # pic, name, artist, album, rid, artistid, albumid, tooltip
        self.liststore_songs = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str,
                                             int, int, int, str)
        self.mv_control_box = Widgets.MVControlBox(self.liststore_songs,
                                                   self.app)
        self.buttonbox.pack_end(self.mv_control_box, False, False, 0)

        self.scrolled_nodes = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_nodes, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_nodes = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                             str)
        iconview_nodes = Widgets.IconView(self.liststore_nodes, tooltip=4)
        iconview_nodes.connect('item_activated',
                               self.on_iconview_nodes_item_activated)
        self.scrolled_nodes.add(iconview_nodes)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        iconview_songs = Widgets.IconView(self.liststore_songs,
                                          info_pos=2,
                                          tooltip=7)
        iconview_songs.connect('item_activated',
                               self.on_iconview_songs_item_activated)
        self.scrolled_songs.add(iconview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_songs.hide()

        nid = 3
        nodes_wrap = Net.get_index_nodes(nid)
        if not nodes_wrap:
            return
        nodes = nodes_wrap['child']
        self.liststore_nodes.clear()
        urls = []
        tree_iters = []
        for node in nodes:
            tree_iter = self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['disname']),
                int(node['sourceid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['disname'], node['info']),
            ])
            tree_iters.append(tree_iter)
            urls.append(node['pic'])
        self.liststore_nodes.timestamp = time.time()
        Net.update_liststore_images(self.liststore_nodes, 0, tree_iters, urls)
コード例 #5
0
ファイル: Artists.py プロジェクト: zihua/kwplayer
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if error or self.artist_mv_total == 0:
         logger.error('append_artist_mv(): %s, %s' %
                      (self.artist_mv_total, error))
         return
     urls = []
     tree_iters = []
     for mv in mvs:
         tree_iter = self.artist_mv_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             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.async_call(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()
コード例 #6
0
ファイル: TopCategories.py プロジェクト: Holdlen2DH/kwplayer
        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()
コード例 #7
0
ファイル: TopCategories.py プロジェクト: zihua/kwplayer
        def _on_append_songs(info, error=None):
            if not info or error:
                logger.error('TopCategories.append_songs(): %s, %s' %
                             (info, error))
                return
            songs, self.songs_total = info
            if not songs or self.songs_total == 0 or self.use_album:
                Net.async_call(Net.get_album,
                               self.curr_list_id,
                               callback=_on_get_album)

            for song in songs:
                self.liststore_songs.append([
                    True,
                    Widgets.unescape(song['name']),
                    Widgets.unescape(song['artist']),
                    Widgets.unescape(song['album']),
                    int(song['id']),
                    int(song['artistid']),
                    int(song['albumid']),
                    song['formats'],
                ])
            self.songs_page += 1
            if self.songs_page < self.songs_total - 1:
                self.append_songs()
コード例 #8
0
 def _append_albums(albums_args, error=None):
     albums, hit, self.albums_total = albums_args
     if hit == 0:
         if reset_status:
             self.albums_button.set_label(
                     '{0} (0)'.format(_('Albums')))
         return
     self.albums_button.set_label(
             '{0} ({1})'.format(_('Albums'), hit))
     i = len(self.liststore_albums)
     for album in albums:
         if 'info' in album and album['info']:
             tooltip = Widgets.set_tooltip(album['name'], album['info'])
         else:
             tooltip = Widgets.escape(album['name'])
         self.liststore_albums.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']), 
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             tooltip,
             ])
         Net.update_album_covers(
                 self.liststore_albums, i, 0, album['pic'])
         i += 1
コード例 #9
0
ファイル: TopCategories.py プロジェクト: Holdlen2DH/kwplayer
        def _on_show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if error or not nodes or not self.sub2_total:
                logger.error('nodes: %s, self.sub2_total: %s, error: %s' %
                        (nodes, self.sub2_total, error))
                return
            urls = []
            tree_iters = []
            for node in nodes:
                tree_iter = self.liststore_sub2.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(node['name'],
                                                       node['tips'])
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub2, 0,
                           tree_iters, urls)

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
コード例 #10
0
ファイル: TopCategories.py プロジェクト: lifuljk/kwplayer
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if not nodes or self.sub1_total == 0:
                return
            for i, node in enumerate(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'])
                self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[_id]),
                    Widgets.unescape(node['info']),
                    _tooltip,
                    ])
                Net.update_liststore_image(
                        self.liststore_sub1, i, 0, node['pic'])

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
コード例 #11
0
ファイル: Themes.py プロジェクト: lifuljk/kwplayer
 def show_sub(self, init=False):
     if init:
         self.scrolled_main.hide()
         self.scrolled_songs.hide()
         self.buttonbox.show_all()
         self.button_sub.hide()
         self.control_box.hide()
         self.scrolled_sub.get_vadjustment().set_value(0)
         self.scrolled_sub.show_all()
         self.nodes_page = 0
         self.liststore_sub.clear()
     nodes, self.nodes_total = Net.get_nodes(
             self.curr_sub_id, self.nodes_page)
     if not nodes:
         return
     for i, node in enumerate(nodes):
         self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(
                 node['name'], node['tips']),
             ])
         Net.update_liststore_image(
                 self.liststore_sub, i, 0, node['pic'])
コード例 #12
0
ファイル: MV.py プロジェクト: 958887233/kwplayer
 def _on_append_songs(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('append_songs():  %s, %s' % (info, error))
         return
     songs, self.songs_total = info
     urls = []
     tree_iters = []
     for song in songs:
         tree_iter = self.liststore_songs.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']), 
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(song['mvpic'])
     Net.async_call(Net.update_mv_images, self.liststore_songs, 0,
                    tree_iters, urls)
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
コード例 #13
0
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if not nodes or self.sub1_total == 0:
                return
            i = len(self.liststore_sub1)
            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'])
                self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[_id]),
                    Widgets.unescape(node['info']),
                    _tooltip,
                ])
                Net.update_liststore_image(self.liststore_sub1, i, 0,
                                           node['pic'])
                i += 1

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
コード例 #14
0
ファイル: Artists.py プロジェクト: Jonham/kwplayer
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if error or self.artist_mv_total == 0:
         logger.error('append_artist_mv(): %s, %s' %
                      (self.artist_mv_total, error))
         return
     urls = []
     tree_iters = []
     for mv in mvs:
         tree_iter = self.artist_mv_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             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.async_call(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()
コード例 #15
0
 def show_sub(self, init=False):
     if init:
         self.scrolled_main.hide()
         self.scrolled_songs.hide()
         self.buttonbox.show_all()
         self.button_sub.hide()
         self.control_box.hide()
         self.scrolled_sub.get_vadjustment().set_value(0)
         self.scrolled_sub.show_all()
         self.nodes_page = 0
         self.liststore_sub.clear()
     nodes, self.nodes_total = Net.get_nodes(self.curr_sub_id,
                                             self.nodes_page)
     if not nodes:
         return
     i = len(self.liststore_sub)
     for node in nodes:
         self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'], node['tips']),
         ])
         Net.update_liststore_image(self.liststore_sub, i, 0, node['pic'])
         i += 1
コード例 #16
0
    def show_songs(self, init=False):
        if init:
            self.app.playlist.advise_new_playlist_name(self.label.get_text())
            self.liststore_songs.clear()
            self.songs_page = 0
            self.scrolled_sub.hide()
            self.button_sub.show_all()
            self.control_box.show_all()
            self.scrolled_songs.get_vadjustment().set_value(0.0)
            self.scrolled_songs.show_all()

        songs, self.songs_total = Net.get_themes_songs(self.curr_list_id,
                                                       self.songs_page)
        if not songs:
            return
        for song in songs:
            self.liststore_songs.append([
                True,
                Widgets.unescape(song['name']),
                Widgets.unescape(song['artist']),
                Widgets.unescape(song['album']),
                int(song['id']),
                int(song['artistid']),
                int(song['albumid']),
            ])
コード例 #17
0
ファイル: MV.py プロジェクト: zihua/kwplayer
 def _on_append_songs(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('append_songs():  %s, %s' % (info, error))
         return
     songs, self.songs_total = info
     urls = []
     tree_iters = []
     for song in songs:
         tree_iter = self.liststore_songs.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']),
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(song['mvpic'])
     Net.async_call(Net.update_mv_images, self.liststore_songs, 0,
                    tree_iters, urls)
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
コード例 #18
0
ファイル: TopCategories.py プロジェクト: Taliens/kwplayer
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if error or not nodes or not self.sub1_total:
                return
            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.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()
コード例 #19
0
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if error or not nodes or not self.sub1_total:
                return
            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.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()
コード例 #20
0
ファイル: Themes.py プロジェクト: lifuljk/kwplayer
    def show_songs(self, init=False):
        if init:
            self.app.playlist.advise_new_playlist_name(
                    self.label.get_text())
            self.liststore_songs.clear()
            self.songs_page = 0
            self.scrolled_sub.hide()
            self.button_sub.show_all()
            self.control_box.show_all()
            self.scrolled_songs.get_vadjustment().set_value(0.0)
            self.scrolled_songs.show_all()

        songs, self.songs_total = Net.get_themes_songs(
                self.curr_list_id, self.songs_page)
        if not songs:
            return
        for song in songs:
            self.liststore_songs.append([
                True,
                Widgets.unescape(song['name']),
                Widgets.unescape(song['artist']),
                Widgets.unescape(song['album']),
                int(song['id']),
                int(song['artistid']), 
                int(song['albumid']),
                ])
コード例 #21
0
ファイル: TopList.py プロジェクト: Taliens/kwplayer
    def first(self):
        app = self.app

        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)
        button_home = Gtk.Button(_('TopList'))
        button_home.connect('clicked', self.on_button_home_clicked)
        self.buttonbox.pack_start(button_home, False, False, 0)
        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(
                bool, str, str, str, int, int, int)
        control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(control_box, False, False, 0)

        self.scrolled_nodes = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_nodes, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_nodes = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_nodes = Widgets.IconView(self.liststore_nodes, tooltip=4)
        iconview_nodes.connect(
                'item_activated', self.on_iconview_nodes_item_activated)
        self.scrolled_nodes.add(iconview_nodes)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_songs.hide()

        nid = 2
        page = 0
        nodes, total_pages = Net.get_nodes(nid, page)
        if total_pages == 0:
            return
        urls = []
        tree_iters = []
        for node in nodes:
            tree_iter = self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['name']),
                int(node['sourceid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip_with_song_tips(
                    node['name'], node['tips']),
                ])
            urls.append(node['pic'])
            tree_iters.append(tree_iter)
        self.liststore_nodes.timestamp = time.time()
        Net.update_liststore_images(self.liststore_nodes, 0, tree_iters, urls)
コード例 #22
0
    def first(self):
        app = self.app

        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)
        button_home = Gtk.Button(_('TopList'))
        button_home.connect('clicked', self.on_button_home_clicked)
        self.buttonbox.pack_start(button_home, False, False, 0)
        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(bool, str, str, str, int, int,
                                             int)
        control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(control_box, False, False, 0)

        self.scrolled_nodes = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_nodes, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_nodes = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                             str)
        iconview_nodes = Widgets.IconView(self.liststore_nodes, tooltip=4)
        iconview_nodes.connect('item_activated',
                               self.on_iconview_nodes_item_activated)
        self.scrolled_nodes.add(iconview_nodes)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_songs.hide()

        nid = 2
        page = 0
        nodes, total_pages = Net.get_nodes(nid, page)
        if total_pages == 0:
            return
        urls = []
        tree_iters = []
        for node in nodes:
            tree_iter = self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['name']),
                int(node['sourceid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip_with_song_tips(node['name'], node['tips']),
            ])
            urls.append(node['pic'])
            tree_iters.append(tree_iter)
        self.liststore_nodes.timestamp = time.time()
        Net.update_liststore_images(self.liststore_nodes, 0, tree_iters, urls)
コード例 #23
0
ファイル: Radio.py プロジェクト: Taliens/kwplayer
    def first(self):
        app = self.app

        # left side panel
        scrolled_myradio = Gtk.ScrolledWindow()
        scrolled_myradio.props.hscrollbar_policy = Gtk.PolicyType.NEVER
        self.pack_start(scrolled_myradio, False, False, 0)

        # radios selected by user.
        self.box_myradio = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.box_myradio.props.margin_left = 10
        scrolled_myradio.add(self.box_myradio)

        self.scrolled_radios = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_radios, True, True, 0)

        # pic, name, id, num of listeners, pic_url, tooltip
        self.liststore_radios = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str, str)
        iconview_radios = Widgets.IconView(
                self.liststore_radios, tooltip=5)
        iconview_radios.connect(
                'item_activated', self.on_iconview_radios_item_activated)
        self.scrolled_radios.add(iconview_radios)

        self.show_all()

        nid = 8
        page = 0
        radios, total_page = Net.get_nodes(nid, page)
        if total_page == 0:
            return
        urls = []
        tree_iters = []
        for radio in radios:
            tree_iter = self.liststore_radios.append([
                self.app.theme['anonymous'],
                Widgets.unescape(radio['disname']), 
                int(radio['sourceid'].split(',')[0]),
                Widgets.unescape(radio['info']),
                radio['pic'],
                Widgets.set_tooltip(radio['disname'], radio['info']),
                ])
            tree_iters.append(tree_iter)
            urls.append(radio['pic'])
        self.liststore_radios.timestamp = time.time()
        Net.update_liststore_images(
                self.liststore_radios, 0, tree_iters, urls)

        for radio in self.playlists:
            radio_item = RadioItem(radio, self.app)
            self.box_myradio.pack_start(radio_item, False, False, 0)

        GLib.timeout_add(300000, self.dump_playlists)
コード例 #24
0
ファイル: Artists.py プロジェクト: lifuljk/kwplayer
 def _append_album_songs(songs, error=None):
     if not songs:
         return
     for song in songs:
         self.album_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(self.curr_album_name),
             int(song['id']),
             int(song['artistid']),
             int(self.curr_album_id), ])
コード例 #25
0
ファイル: Radio.py プロジェクト: zihua/kwplayer
    def first(self):
        app = self.app

        # left side panel
        scrolled_myradio = Gtk.ScrolledWindow()
        scrolled_myradio.props.hscrollbar_policy = Gtk.PolicyType.NEVER
        self.pack_start(scrolled_myradio, False, False, 0)

        # radios selected by user.
        self.box_myradio = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.box_myradio.props.margin_left = 10
        scrolled_myradio.add(self.box_myradio)

        self.scrolled_radios = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_radios, True, True, 0)

        # pic, name, id, num of listeners, pic_url, tooltip
        self.liststore_radios = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int,
                                              str, str, str)
        iconview_radios = Widgets.IconView(self.liststore_radios, tooltip=5)
        iconview_radios.connect('item_activated',
                                self.on_iconview_radios_item_activated)
        self.scrolled_radios.add(iconview_radios)

        self.show_all()

        nid = 8
        page = 0
        radios, total_page = Net.get_nodes(nid, page)
        if total_page == 0:
            return
        urls = []
        tree_iters = []
        for radio in radios:
            tree_iter = self.liststore_radios.append([
                Config.ANONYMOUS_PIXBUF,
                Widgets.unescape(radio['disname']), 
                int(radio['sourceid'].split(',')[0]),
                Widgets.unescape(radio['info']),
                radio['pic'],
                Widgets.set_tooltip(radio['disname'], radio['info']),
            ])
            tree_iters.append(tree_iter)
            urls.append(radio['pic'])
        self.liststore_radios.timestamp = time.time()
        Net.async_call(Net.update_liststore_images, self.liststore_radios, 0,
                       tree_iters, urls)

        for radio_rid in self.playlists:
            radio_item = RadioItem(radio_rid, self.app)
            self.box_myradio.pack_start(radio_item, False, False, 0)

        GLib.timeout_add(300000, self.dump_playlists)
コード例 #26
0
 def _append_album_songs(songs, error=None):
     if error or not songs:
         return
     for song in songs:
         self.album_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(self.curr_album_name),
             int(song['id']),
             int(song['artistid']),
             int(self.curr_album_id),
         ])
コード例 #27
0
ファイル: Search.py プロジェクト: hao707822882/kwplayer
 def _append_songs(songs_args, error=None):
     songs, hit, self.songs_total = songs_args
     if not error and songs and hit:
         for song in songs:
             self.liststore_songs.append([
                 False,
                 Widgets.unescape(song['SONGNAME']),
                 Widgets.unescape(song['ARTIST']),
                 Widgets.unescape(song['ALBUM']),
                 int(song['MUSICRID'][6:]),
                 int(song['ARTISTID']),
                 int(song['ALBUMID']),
                 ])
     self.songs_button.set_label('{0} ({1})'.format(
         _('Songs'), len(self.liststore_songs)))
コード例 #28
0
ファイル: Artists.py プロジェクト: Jonham/kwplayer
 def _append_album_songs(songs, error=None):
     if error or not songs:
         logger.error('append_album_songs(): %s, %s' % (songs, error))
         return
     for song in songs:
         self.album_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(self.curr_album_name),
             int(song['id']),
             int(song['artistid']),
             int(self.curr_album_id),
             song['formats'],
         ])
コード例 #29
0
ファイル: Artists.py プロジェクト: zihua/kwplayer
 def _append_album_songs(songs, error=None):
     if error or not songs:
         logger.error('append_album_songs(): %s, %s' % (songs, error))
         return
     for song in songs:
         self.album_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(self.curr_album_name),
             int(song['id']),
             int(song['artistid']),
             int(self.curr_album_id),
             song['formats'],
         ])
コード例 #30
0
 def _append_songs(songs_args, error=None):
     songs, hit, self.songs_total = songs_args
     if not error and songs and hit:
         for song in songs:
             self.liststore_songs.append([
                 False,
                 Widgets.unescape(song['SONGNAME']),
                 Widgets.unescape(song['ARTIST']),
                 Widgets.unescape(song['ALBUM']),
                 int(song['MUSICRID'][6:]),
                 int(song['ARTISTID']),
                 int(song['ALBUMID']),
             ])
     self.songs_button.set_label('{0} ({1})'.format(
         _('Songs'), len(self.liststore_songs)))
コード例 #31
0
ファイル: Themes.py プロジェクト: Holdlen2DH/kwplayer
 def _on_get_themes_songs(info, error):
     if not info or not info[0] or not info[1] or error:
         logger.error('show_songs(): %s, %s' % (info, error))
         return
     songs, self.songs_total = info
     for song in songs:
         self.liststore_songs.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']), 
             int(song['albumid']),
             song['formats'],
         ])
コード例 #32
0
 def _on_get_themes_songs(info, error):
     if not info or not info[0] or not info[1] or error:
         logger.error('show_songs(): %s, %s' % (info, error))
         return
     songs, self.songs_total = info
     for song in songs:
         self.liststore_songs.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']),
             int(song['albumid']),
             song['formats'],
         ])
コード例 #33
0
ファイル: Artists.py プロジェクト: zihua/kwplayer
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if error or not self.artist_similar_total:
         logger.error('append_artist_similar(): %s, %s' %
                      (self.artist_similar_total, error))
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ''.join([
             artist['songnum'],
             _(' songs'),
         ])
         tree_iter = self.artist_similar_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(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()
コード例 #34
0
ファイル: Artists.py プロジェクト: blueyi/kwplayer
    def append_artists(self, init=False):
        if init:
            self.artists_liststore.clear()
            self.artists_page = 0
            self.artists_win.get_vadjustment().set_value(0)
        selection = self.cate_treeview.get_selection()
        result = selection.get_selected()
        if result is None or len(result) != 2:
            return
        model, _iter = result
        pref_index = self.pref_combo.get_active()
        catid = model[_iter][1]
        prefix = self.pref_liststore[pref_index][1]
        # TODO: use async_call()
        artists, self.artists_total = Net.get_artists(
                catid, self.artists_page, prefix)
        if self.artists_total == 0:
            return

        i = len(self.artists_liststore)
        for artist in artists:
            _info = ' '.join([artist['music_num'], _(' songs'), ])
            self.artists_liststore.append([
                self.app.theme['anonymous'],
                Widgets.unescape(artist['name']),
                int(artist['id']), 
                _info,
                Widgets.set_tooltip(artist['name'], _info),
                ])
            Net.update_artist_logo(
                    self.artists_liststore, i, 0, artist['pic'])
            i += 1
コード例 #35
0
    def append_artists(self, init=False):
        if init:
            self.artists_liststore.clear()
            self.artists_page = 0
            self.artists_win.get_vadjustment().set_value(0)
        selection = self.cate_treeview.get_selection()
        result = selection.get_selected()
        if result is None or len(result) != 2:
            return
        model, _iter = result
        pref_index = self.pref_combo.get_active()
        catid = model[_iter][1]
        prefix = self.pref_liststore[pref_index][1]
        # TODO: use async_call()
        artists, self.artists_total = Net.get_artists(catid, self.artists_page,
                                                      prefix)
        if self.artists_total == 0:
            return

        i = len(self.artists_liststore)
        for artist in artists:
            _info = ' '.join([
                artist['music_num'],
                _(' songs'),
            ])
            self.artists_liststore.append([
                self.app.theme['anonymous'],
                Widgets.unescape(artist['name']),
                int(artist['id']),
                _info,
                Widgets.set_tooltip(artist['name'], _info),
            ])
            Net.update_artist_logo(self.artists_liststore, i, 0, artist['pic'])
            i += 1
コード例 #36
0
 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()
コード例 #37
0
ファイル: TopList.py プロジェクト: zhcj/kwplayer
 def _on_get_toplist_songs(songs, error):
     if not songs or error:
         logger.error('show_toplist_songs(), songs: %s, error: %s' %
                      (songs, error))
         return
     self.liststore_songs.clear()
     for song in songs:
         self.liststore_songs.append([
             True,
             Widgets.unescape(song['name']), 
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']), 
             int(song['artistid']),
             int(song['albumid']),
             song['formats'],
         ])
コード例 #38
0
ファイル: TopList.py プロジェクト: Holdlen2DH/kwplayer
 def _on_get_toplist_songs(songs, error):
     if not songs or error:
         logger.error('show_toplist_songs(), songs: %s, error: %s' %
                      (songs, error))
         return
     self.liststore_songs.clear()
     for song in songs:
         self.liststore_songs.append([
             True,
             Widgets.unescape(song['name']), 
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']), 
             int(song['artistid']),
             int(song['albumid']),
             song['formats'],
         ])
コード例 #39
0
ファイル: Search.py プロジェクト: Taliens/kwplayer
 def _append_songs(songs_args, error=None):
     songs, hit, self.songs_total = songs_args
     if not songs or hit == 0:
         if reset_status:
             self.songs_button.set_label('{0} (0)'.format(_('Songs')))
         return
     self.songs_button.set_label('{0} ({1})'.format(_('Songs'), hit))
     for song in songs:
         self.liststore_songs.append([
             False,
             Widgets.unescape(song['SONGNAME']),
             Widgets.unescape(song['ARTIST']),
             Widgets.unescape(song['ALBUM']),
             int(song['MUSICRID'][6:]),
             int(song['ARTISTID']),
             int(song['ALBUMID']),
             ])
コード例 #40
0
 def _append_songs(songs_args, error=None):
     songs, hit, self.songs_total = songs_args
     if not songs or hit == 0:
         if reset_status:
             self.songs_button.set_label('{0} (0)'.format(_('Songs')))
         return
     self.songs_button.set_label('{0} ({1})'.format(_('Songs'), hit))
     for song in songs:
         self.liststore_songs.append([
             False,
             Widgets.unescape(song['SONGNAME']),
             Widgets.unescape(song['ARTIST']),
             Widgets.unescape(song['ALBUM']),
             int(song['MUSICRID'][6:]),
             int(song['ARTISTID']),
             int(song['ALBUMID']),
             ])
コード例 #41
0
ファイル: TopCategories.py プロジェクト: zihua/kwplayer
 def _on_get_album(songs, error=None):
     self.songs_total = 1
     if not songs or error:
         logger.error('TopCategories._on_get_album: %s, %s' %
                      (songs, error))
         return
     for song in songs:
         self.liststore_songs.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(self.curr_list_name),
             int(song['id']),
             int(song['artistid']),
             int(self.curr_list_id),
             song['formats'],
         ])
コード例 #42
0
ファイル: TopCategories.py プロジェクト: Holdlen2DH/kwplayer
 def _on_get_album(songs, error=None):
     self.songs_total = 1
     if not songs or error:
         logger.error('TopCategories._on_get_album: %s, %s' %
                      (songs, error))
         return
     for song in songs:
         self.liststore_songs.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(self.curr_list_name),
             int(song['id']),
             int(song['artistid']),
             int(self.curr_list_id),
             song['formats'],
         ])
コード例 #43
0
ファイル: Search.py プロジェクト: hao707822882/kwplayer
        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([
                        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)

            self.artists_button.set_label('{0} ({1})'.format(
                    _('Artists'), len(self.liststore_artists)))
コード例 #44
0
ファイル: Search.py プロジェクト: lifuljk/kwplayer
 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))
     for i, artist in enumerate(artists):
         self.liststore_artists.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['ARTIST']),
             int(artist['ARTISTID']), 
             Widgets.unescape(artist['COUNTRY']),
             ])
         Net.update_artist_logo(
                 self.liststore_artists, i, 0, artist['PICPATH'])
コード例 #45
0
        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([
                        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)

            self.artists_button.set_label('{0} ({1})'.format(
                _('Artists'), len(self.liststore_artists)))
コード例 #46
0
ファイル: Artists.py プロジェクト: lifuljk/kwplayer
 def _append_artist_songs(songs_args, error=None):
     songs, self.artist_songs_total = songs_args
     if self.artist_songs_total == 0:
         return
     for song in songs:
         self.artist_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['musicrid']),
             int(song['artistid']), 
             int(song['albumid']),
             ]) 
     # automatically load more songs
     self.artist_songs_page += 1
     if self.artist_songs_page < self.artist_songs_total - 1:
         self.append_artist_songs()
コード例 #47
0
ファイル: Artists.py プロジェクト: lifuljk/kwplayer
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if self.artist_albums_total == 0:
         return
     for i, album in enumerate(albums):
         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']),
             ])
         Net.update_album_covers(
                 self.artist_albums_liststore, i, 0, album['pic'])
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
コード例 #48
0
 def _append_artist_songs(songs_args, error=None):
     songs, self.artist_songs_total = songs_args
     if error or self.artist_songs_total == 0:
         return
     for song in songs:
         self.artist_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['musicrid']),
             int(song['artistid']),
             int(song['albumid']),
         ])
     # automatically load more songs
     self.artist_songs_page += 1
     if self.artist_songs_page < self.artist_songs_total - 1:
         self.append_artist_songs()
コード例 #49
0
ファイル: TopCategories.py プロジェクト: lifuljk/kwplayer
        def _show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if not nodes or self.sub2_total == 0:
                return
            for i, node in enumerate(nodes):
                self.liststore_sub2.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(
                        node['name'], node['tips']),
                    ])
                Net.update_liststore_image(
                        self.liststore_sub2, i, 0, node['pic'])

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
コード例 #50
0
ファイル: Themes.py プロジェクト: Holdlen2DH/kwplayer
 def _on_get_themes(nodes, error):
     if not nodes:
         logger.warn('_on_get_themes(): %s, %s' % (nodes, error))
         return
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_main.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['nid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['name'], node['info']),
             ])
         urls.append(node['pic'])
         tree_iters.append(tree_iter)
     self.liststore_main.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_main, 0,
                    tree_iters, urls)
コード例 #51
0
    def show_toplist_songs(self, nid):
        self.scrolled_nodes.hide()
        self.scrolled_songs.show_all()

        songs = Net.get_toplist_songs(nid)
        if not songs:
            print('Error, failed to get toplist songs')
            return
        self.liststore_songs.clear()
        for song in songs:
            self.liststore_songs.append([
                True,
                Widgets.unescape(song['name']), 
                Widgets.unescape(song['artist']),
                Widgets.unescape(song['album']),
                int(song['id']), 
                int(song['artistid']),
                int(song['albumid']),
                ])
コード例 #52
0
 def _on_get_themes(nodes, error):
     if not nodes:
         logger.warn('_on_get_themes(): %s, %s' % (nodes, error))
         return
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_main.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['name']),
             int(node['nid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['name'], node['info']),
         ])
         urls.append(node['pic'])
         tree_iters.append(tree_iter)
     self.liststore_main.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_main, 0,
                    tree_iters, urls)
コード例 #53
0
 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:
         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']),
         ])
         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()
コード例 #54
0
ファイル: Search.py プロジェクト: Taliens/kwplayer
 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)
コード例 #55
0
 def on_show_sub(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('show_sub(): %s, %s' % (info, error))
         return
     nodes, self.nodes_total = info
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_sub.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     Net.async_call(Net.update_liststore_images, self.liststore_sub, 0,
                    tree_iters, urls)
コード例 #56
0
ファイル: Themes.py プロジェクト: Holdlen2DH/kwplayer
 def on_show_sub(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('show_sub(): %s, %s' % (info, error))
         return
     nodes, self.nodes_total = info
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     Net.async_call(Net.update_liststore_images, self.liststore_sub, 0,
                    tree_iters, urls)
コード例 #57
0
 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'],
             Widgets.unescape(artist['ARTIST']),
             int(artist['ARTISTID']), 
             Widgets.unescape(artist['COUNTRY']),
             ])
         Net.update_artist_logo(
                 self.liststore_artists, i, 0, artist['PICPATH'])
         i += 1
コード例 #58
0
ファイル: Artists.py プロジェクト: lifuljk/kwplayer
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if self.artist_mv_total == 0:
         return
     for i, mv in enumerate(mvs):
         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']),
             ])
         Net.update_mv_image(
                 self.artist_mv_liststore, i, 0, mv['pic'])
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
コード例 #59
0
ファイル: Artists.py プロジェクト: Jonham/kwplayer
 def _append_artist_songs(songs_args, error=None):
     if error or not songs_args or not songs_args[1]:
         logger.error('append_artist_songs(): %s, %s' %
                      (self.artist_songs_total, error))
         return
     songs, self.artist_songs_total = songs_args
     for song in songs:
         self.artist_songs_liststore.append([
             True,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['musicrid']),
             int(song['artistid']), 
             int(song['albumid']),
             song['formats'],
         ]) 
     # automatically load more songs
     self.artist_songs_page += 1
     if self.artist_songs_page < self.artist_songs_total - 1:
         self.append_artist_songs()