示例#1
0
 def _load_page_content(self, page, artist):
     """
         Load artist page content
         @param page as str
         @param artist as str
     """
     wp = Wikipedia()
     (url, image_url, content) = wp.get_page_infos(page)
     if artist == self._artist:
         ArtistContent.populate(self, content, image_url, 'wikipedia')
示例#2
0
 def _load_page_content(self, page, artist):
     """
         Load artist page content
         @param page as str
         @param artist as str
     """
     wp = Wikipedia()
     (url, image_url, content) = wp.get_page_infos(page)
     if artist == self._artist:
         ArtistContent.populate(self, content, image_url, 'wikipedia')
示例#3
0
 def _setup_menu(self, artist):
     """
         Setup menu for artist
         @param artist as str
     """
     if artist == self._artist:
         wp = Wikipedia()
         result = wp.search(artist)
         if artist in result:
             result.remove(artist)
         GLib.idle_add(self._setup_menu_strings, result)
示例#4
0
 def __setup_menu(self, artist, album):
     """
         Setup menu for artist
         @param artist as str
         @param album as str
     """
     wp = Wikipedia()
     result = wp.search(artist)
     result += wp.search(artist + ' ' + album)
     cleaned = list(set(result))
     if artist in cleaned:
         cleaned.remove(artist)
     GLib.idle_add(self.__setup_menu_strings, cleaned)
示例#5
0
 def __setup_menu(self, artist, album):
     """
         Setup menu for artist
         @param artist as str
         @param album as str
     """
     wp = Wikipedia()
     result = wp.search(artist)
     result += wp.search(artist + ' ' + album)
     cleaned = list(set(result))
     if artist in cleaned:
         cleaned.remove(artist)
     GLib.idle_add(self.__setup_menu_strings, cleaned)
示例#6
0
 def _setup_menu(self, artists, album):
     """
         Setup menu for artist
         @param artists as str
         @param album as str
     """
     if artists == self._artists:
         wp = Wikipedia()
         result = wp.search(artists)
         result += wp.search(artists + ' ' + album)
         cleaned = list(set(result))
         if artists in cleaned:
             cleaned.remove(artists)
         GLib.idle_add(self._setup_menu_strings, cleaned)
示例#7
0
 def _setup_menu(self, artists, album):
     """
         Setup menu for artist
         @param artists as str
         @param album as str
     """
     if artists == self._artists:
         wp = Wikipedia()
         result = wp.search(artists)
         result += wp.search(artists + ' ' + album)
         cleaned = list(set(result))
         if artists in cleaned:
             cleaned.remove(artists)
         GLib.idle_add(self._setup_menu_strings, cleaned)
示例#8
0
 def _load_page_content(self, artist):
     """
         Load artist page content
         @param artist as str
     """
     self._menu_model.remove_all()
     wp = Wikipedia()
     (url, image_url, content) = wp.get_page_infos(artist)
     if not self._stop:
         InfoContent.set_content(self, self._artist, content,
                                 image_url, 'wikipedia')
         t = Thread(target=self._setup_menu,
                    args=(self._artist, self._album))
         t.daemon = True
         t.start()
示例#9
0
 def __load_page_content(self, artist):
     """
         Load artist page content
         @param artist as str
     """
     GLib.idle_add(self.__menu_model.remove_all)
     wp = Wikipedia()
     try:
         (url, content) = wp.get_page_infos(artist)
     except:
         url = content = None
     if not self._stop:
         InfoContent.set_content(self, self._artist, content, url,
                                 'wikipedia')
         t = Thread(target=self.__setup_menu,
                    args=(self._artist, self.__album))
         t.daemon = True
         t.start()
示例#10
0
 def _load_page_content(self, artist):
     """
         Load artist page content
         @param artist as str
     """
     GLib.idle_add(self._menu_model.remove_all)
     wp = Wikipedia()
     try:
         (url, content) = wp.get_page_infos(artist)
     except:
         url = content = None
     if not self._stop:
         InfoContent.set_content(self, self._artist, content,
                                 url, 'wikipedia')
         t = Thread(target=self._setup_menu,
                    args=(self._artist, self._album))
         t.daemon = True
         t.start()
示例#11
0
 def _on_row_activated(self, listbox, row):
     """
         Update artist information
         @param listbox as Gtk.ListBox
         @param row as Gtk.ListBoxRow
     """
     self.__stack.set_visible_child_name("main")
     from lollypop.wikipedia import Wikipedia
     wikipedia = Wikipedia()
     App().task_helper.run(wikipedia.get_content_for_page_id,
                           row.page_id, row.locale,
                           callback=(self.__on_wikipedia_get_content,))
示例#12
0
 def _on_info_label_press(self, x, y, event):
     """
         Show information cache (for edition)
         @param x as int
         @param y as int
         @param event as Gdk.Event
     """
     if get_network_available("WIKIPEDIA"):
         from lollypop.wikipedia import Wikipedia
         wikipedia = Wikipedia()
         self.__stack.set_visible_child_name("select")
         App().task_helper.run(wikipedia.get_search_list,
                               self.__artist_name,
                               callback=(self.__on_wikipedia_search_list,))