示例#1
0
 def _on_reset_confirm(self, button):
     """
         Reset artwork
         @param button as Gtk.Button
     """
     ArtworkSearchWidget._on_reset_confirm(self, button)
     App().art.add_radio_artwork(self.__name, None)
示例#2
0
 def __init__(self, album):
     """
         Init search
         @param album as Album
     """
     ArtworkSearchWidget.__init__(self)
     self.__album = album
示例#3
0
 def __init__(self, name):
     """
         Init search
         @param name as str
     """
     ArtworkSearchWidget.__init__(self)
     self.__name = name
 def __init__(self, artist_id):
     """
         Init search
         @param artist_id as int
     """
     ArtworkSearchWidget.__init__(self)
     self.__artist = App().artists.get_name(artist_id)
 def __init__(self, album, view_type, in_menu=False):
     """
         Init search
         @param album as Album
         @param view_type as ViewType
     """
     ArtworkSearchWidget.__init__(self, view_type)
     self.__album = album
 def __init__(self, artist_id, view_type, in_menu=False):
     """
         Init search
         @param artist_id as int
         @param view_type as ViewType
     """
     ArtworkSearchWidget.__init__(self, view_type)
     self.__artist = App().artists.get_name(artist_id)
示例#7
0
 def _on_reset_confirm(self, button):
     """
         Reset artwork
         @param button as Gtk.Button
     """
     ArtworkSearchWidget._on_reset_confirm(self, button)
     App().art.remove_album_artwork(self.__album)
     App().art.save_album_artwork(None, self.__album)
     App().art.clean_album_cache(self.__album)
     App().art.emit("album-artwork-changed", self.__album.id)
示例#8
0
 def __init__(self, artist_id):
     """
         Init Popover
         @param album as album
     """
     CommonPopover.__init__(self)
     self._widget = ArtworkSearchWidget(artist_id, None)
     self._widget.show()
     self.add(self._widget)
     self._widget.populate()
示例#9
0
class ArtworkPopover(CommonPopover):
    """
        Popover with artist-artwork from the web
    """
    def __init__(self, artist_id):
        """
            Init Popover
            @param album as album
        """
        CommonPopover.__init__(self)
        self._widget = ArtworkSearchWidget(artist_id, None)
        self._widget.show()
        self.add(self._widget)
        self._widget.populate()
示例#10
0
 def __init__(self, album):
     """
         Init Popover
         @param album as album
     """
     CommonPopover.__init__(self)
     if not album.artist_ids:
         self._widget = None
         return
     # FIXME We only search with first artist
     self._widget = ArtworkSearchWidget(album.artist_ids[0], album)
     self._widget.show()
     self.add(self._widget)
     self._widget.populate()
示例#11
0
 def _on_activate(self, flowbox, child):
     """
         Save artwork
         @param flowbox as Gtk.FlowBox
         @param child as ArtworkSearchChild
     """
     try:
         if isinstance(child, ArtworkSearchChild):
             self._close_popover()
             App().art.save_album_artwork(child.bytes, self.__album)
             self._streams = {}
         else:
             ArtworkSearchWidget._on_activate(self, flowbox, child)
     except Exception as e:
         Logger.error("AlbumArtworkSearchWidget::_on_activate(): %s", e)
示例#12
0
 def populate(self):
     """
         Populate view
     """
     try:
         ArtworkSearchWidget.populate(self)
         # First load local files
         uris = App().art.get_album_artworks(self.__album)
         # Direct load, not using loopback because not many items
         for uri in uris:
             child = ArtworkSearchChild(_("Local"))
             child.show()
             f = Gio.File.new_for_uri(uri)
             (status, content, tag) = f.load_contents()
             if status:
                 status = child.populate(content)
             if status:
                 self._flowbox.add(child)
     except Exception as e:
         Logger.error("AlbumArtworkSearchWidget::populate(): %s", e)
示例#13
0
 def _get_current_search(self):
     """
         Return current searches
         @return str
     """
     search = ArtworkSearchWidget._get_current_search(self)
     if search != "":
         pass
     else:
         search = self.__name
     return search
示例#14
0
 def _get_current_search(self):
     """
         Return current searches
         @return str
     """
     search = ArtworkSearchWidget._get_current_search(self)
     if search != "":
         pass
     else:
         is_compilation = self.__album.artist_ids and\
             self.__album.artist_ids[0] == Type.COMPILATIONS
         if is_compilation:
             search = self.__album.name
         else:
             search = "%s+%s" % (self.__album.artists[0], self.__album.name)
     return search