Esempio n. 1
0
        amz = parse_amazon_url(url)
        if amz is None:
            return
        log.debug("Found ASIN relation : %s %s", amz['host'], amz['asin'])
        self._has_url_relation = True
        if amz['host'] in AMAZON_SERVER:
            server_info = AMAZON_SERVER[amz['host']]
        else:
            server_info = AMAZON_SERVER['amazon.com']
        self._queue_asin(server_info, amz['asin'])

    def _queue_from_asin(self):
        asin = self.release.get('asin')
        if asin:
            log.debug("Found ASIN : %s", asin)
            for server_info in AMAZON_SERVER.values():
                self._queue_asin(server_info, asin)

    def _queue_asin(self, server_info, asin):
        host = server_info['server']
        for size in AMAZON_SIZES:
            path = AMAZON_IMAGE_PATH % {
                'asin': asin,
                'serverid': server_info['id'],
                'size': size
            }
            self.queue_put(CoverArtImage("http://%s%s" % (host, path)))


register_cover_art_provider(CoverArtProviderAmazon)
Esempio n. 2
0
    ]

    def __init__(self, parent=None):
        super(FanartTvOptionsPage, self).__init__(parent)
        self.ui = Ui_FanartTvOptionsPage()
        self.ui.setupUi(self)

    def load(self):
        self.ui.fanarttv_client_key.setText(
            config.setting["fanarttv_client_key"])
        if config.setting["fanarttv_use_cdart"] == OPTION_CDART_ALWAYS:
            self.ui.fanarttv_cdart_use_always.setChecked(True)
        elif config.setting["fanarttv_use_cdart"] == OPTION_CDART_NEVER:
            self.ui.fanarttv_cdart_use_never.setChecked(True)
        elif config.setting["fanarttv_use_cdart"] == OPTION_CDART_NOALBUMART:
            self.ui.fanarttv_cdart_use_if_no_albumcover.setChecked(True)

    def save(self):
        config.setting["fanarttv_client_key"] = unicode(
            self.ui.fanarttv_client_key.text())
        if self.ui.fanarttv_cdart_use_always.isChecked():
            config.setting["fanarttv_use_cdart"] = OPTION_CDART_ALWAYS
        elif self.ui.fanarttv_cdart_use_never.isChecked():
            config.setting["fanarttv_use_cdart"] = OPTION_CDART_NEVER
        elif self.ui.fanarttv_cdart_use_if_no_albumcover.isChecked():
            config.setting["fanarttv_use_cdart"] = OPTION_CDART_NOALBUMART


register_cover_art_provider(CoverArtProviderFanartTv)
register_options_page(FanartTvOptionsPage)
Esempio n. 3
0
        TextOption("setting", "fanarttv_client_key", ""),
        TextOption("setting", "fanarttv_use_cdart", OPTION_CDART_NOALBUMART),
    ]

    def __init__(self, parent=None):
        super(FanartTvOptionsPage, self).__init__(parent)
        self.ui = Ui_FanartTvOptionsPage()
        self.ui.setupUi(self)

    def load(self):
        self.ui.fanarttv_client_key.setText(config.setting["fanarttv_client_key"])
        if config.setting["fanarttv_use_cdart"] == OPTION_CDART_ALWAYS:
            self.ui.fanarttv_cdart_use_always.setChecked(True)
        elif config.setting["fanarttv_use_cdart"] == OPTION_CDART_NEVER:
            self.ui.fanarttv_cdart_use_never.setChecked(True)
        elif config.setting["fanarttv_use_cdart"] == OPTION_CDART_NOALBUMART:
            self.ui.fanarttv_cdart_use_if_no_albumcover.setChecked(True)

    def save(self):
        config.setting["fanarttv_client_key"] = unicode(self.ui.fanarttv_client_key.text())
        if self.ui.fanarttv_cdart_use_always.isChecked():
            config.setting["fanarttv_use_cdart"] = OPTION_CDART_ALWAYS
        elif self.ui.fanarttv_cdart_use_never.isChecked():
            config.setting["fanarttv_use_cdart"] = OPTION_CDART_NEVER
        elif self.ui.fanarttv_cdart_use_if_no_albumcover.isChecked():
            config.setting["fanarttv_use_cdart"] = OPTION_CDART_NOALBUMART


register_cover_art_provider(CoverArtProviderFanartTv)
register_options_page(FanartTvOptionsPage)
Esempio n. 4
0
    PARENT = "plugins"

    options = [
        TextOption("setting", "theaudiodb_use_cdart", OPTION_CDART_NOALBUMART),
    ]

    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_TheAudioDbOptionsPage()
        self.ui.setupUi(self)

    def load(self):
        if config.setting["theaudiodb_use_cdart"] == OPTION_CDART_ALWAYS:
            self.ui.theaudiodb_cdart_use_always.setChecked(True)
        elif config.setting["theaudiodb_use_cdart"] == OPTION_CDART_NEVER:
            self.ui.theaudiodb_cdart_use_never.setChecked(True)
        elif config.setting["theaudiodb_use_cdart"] == OPTION_CDART_NOALBUMART:
            self.ui.theaudiodb_cdart_use_if_no_albumcover.setChecked(True)

    def save(self):
        if self.ui.theaudiodb_cdart_use_always.isChecked():
            config.setting["theaudiodb_use_cdart"] = OPTION_CDART_ALWAYS
        elif self.ui.theaudiodb_cdart_use_never.isChecked():
            config.setting["theaudiodb_use_cdart"] = OPTION_CDART_NEVER
        elif self.ui.theaudiodb_cdart_use_if_no_albumcover.isChecked():
            config.setting["theaudiodb_use_cdart"] = OPTION_CDART_NOALBUMART


register_cover_art_provider(CoverArtProviderTheAudioDb)
register_options_page(TheAudioDbOptionsPage)
Esempio n. 5
0
                if self._retry_search:
                    self.error('no results found')
                    return
                self._retry_search = True
                self.queue_images()
                return
            artist = self._artist()
            album = self.metadata['album']
            for result in results:
                if not isinstance(result, obj.Track):
                    continue
                if not is_similar(artist, result.artist.name) or not is_similar(album, result.album.title):
                    continue
                cover_url = result.album.cover_url(obj.CoverSize(config.setting['deezerart_size']))
                self.queue_put(CoverArtImage(cover_url))
                self.log_debug('queued cover using a Deezer search')
                return
            self.error('no result matched the criteria')
        finally:
            self.next_in_queue()

    def _artist(self) -> str:
        # If there are many artists, we want to search
        # the album in Deezer with just one as keyword.
        # Deezerart may not specify all the artists
        # MusicBrainz does, or it may use different separators.
        return self.metadata.getraw('~albumartists')[0]


providers.register_cover_art_provider(Provider)