Пример #1
0
 def _loading_finished(self, callback, result=None, error=None):
     if self.state != File.PENDING or self.tagger.stopping:
         return
     if error is not None:
         self.error = str(error)
         self.state = self.ERROR
         from picard.formats import supported_extensions
         file_name, file_extension = os.path.splitext(self.base_filename)
         if file_extension not in supported_extensions():
             self.remove()
             log.error(
                 'Unsupported media file %r wrongly loaded. Removing ...',
                 self)
             return
     else:
         self.error = None
         self.state = self.NORMAL
         self._copy_loaded_metadata(result)
     # use cached fingerprint from file metadata
     if not config.setting["ignore_existing_acoustid_fingerprints"]:
         fingerprints = self.metadata.getall('acoustid_fingerprint')
         if fingerprints:
             self.set_acoustid_fingerprint(fingerprints[0])
     run_file_post_load_processors(self)
     self.update()
     callback(self)
Пример #2
0
    def load(self):
        args = {
            "picard_doc_url": PICARD_URLS['home'],
            "picard_donate_url": PICARD_URLS['donate'],
        }
        args.update(versions.as_dict(i18n=True))

        args["formats"] = ", ".join(
            map(lambda x: x[1:], supported_extensions()))

        # TR: Replace this with your name to have it appear in the "About" dialog.
        args["translator_credits"] = _("translator-credits")
        if args["translator_credits"] != "translator-credits":
            # TR: Replace LANG with language you are translating to.
            args["translator_credits"] = _(
                "<br/>Translated to LANG by %s"
            ) % args["translator_credits"].replace("\n", "<br/>")
        else:
            args["translator_credits"] = ""

        args['third_parties_versions'] = '<br />'.join([
            "%s %s" % (versions.version_name(name), value)
            for name, value in versions.as_dict(i18n=True).items()
            if name != 'version'
        ])
        args['authors_credits'] = ", ".join([
            'Robert Kaye',
            'Lukáš Lalinský',
            'Laurent Monin',
            'Sambhav Kothari',
            'Philipp Wolfer',
        ])
        args['copyright_years'] = '2004-2020'
        args['icons_credits'] = _(
            """Icons made by Sambhav Kothari <*****@*****.**>
and <a href="http://www.flaticon.com/authors/madebyoliver">Madebyoliver</a>,
<a href="http://www.flaticon.com/authors/pixel-buddha">Pixel Buddha</a>,
<a href="http://www.flaticon.com/authors/nikita-golubev">Nikita Golubev</a>,
<a href="http://www.flaticon.com/authors/maxim-basinski">Maxim Basinski</a>,
<a href="https://www.flaticon.com/authors/smashicons">Smashicons</a>
from <a href="https://www.flaticon.com">www.flaticon.com</a>""")

        text = _(
            """<p align="center"><span style="font-size:15px;font-weight:bold;">MusicBrainz Picard</span><br/>
Version %(version)s</p>
<p align="center"><small>
%(third_parties_versions)s
</small></p>
<p align="center"><strong>Supported formats</strong><br/>%(formats)s</p>
<p align="center"><strong>Please donate</strong><br/>
Thank you for using Picard. Picard relies on the MusicBrainz database, which is operated by the MetaBrainz Foundation with the help of thousands of volunteers. If you like this application please consider donating to the MetaBrainz Foundation to keep the service running.</p>
<p align="center"><a href="%(picard_donate_url)s">Donate now!</a></p>
<p align="center"><strong>Credits</strong><br/>
<small>Copyright © %(copyright_years)s %(authors_credits)s and others%(translator_credits)s</small></p>
<p align="center"><small>%(icons_credits)s</small></p>
<p align="center"><strong>Official website</strong><br/><a href="%(picard_doc_url)s">%(picard_doc_url)s</a></p>
""") % args
        self.ui.label.setOpenExternalLinks(True)
        self.ui.label.setText(text)
Пример #3
0
    def load(self):
        args = {
            "picard-doc-url": PICARD_URLS['home'],
            "picard-donate-url": PICARD_URLS['donate'],
        }
        args.update(versions.as_dict(i18n=True))

        args["formats"] = ", ".join(map(lambda x: x[1:], supported_extensions()))

        # TR: Replace this with your name to have it appear in the "About" dialog.
        args["translator-credits"] = _("translator-credits")
        if args["translator-credits"] != "translator-credits":
            # TR: Replace LANG with language you are translating to.
            args["translator-credits"] = _("<br/>Translated to LANG by %s") % args["translator-credits"].replace("\n", "<br/>")
        else:
            args["translator-credits"] = ""

        args['third_parties_versions'] = '<br />'.join(["%s %s" %
                                                        (versions.version_name(name), value) for name, value
                                                        in versions.as_dict(i18n=True).items()
                                                        if name != 'version'])
        args['authors-credits'] = ", ".join([
            'Robert Kaye',
            'Lukáš Lalinský',
            'Laurent Monin',
            'Sambhav Kothari',
            'Philipp Wolfer',
        ])
        args['copyright-years'] = '2004-2018'
        args['icons-credits'] = _("""Icons made by Sambhav Kothari <*****@*****.**>
and <a href="http://www.flaticon.com/authors/madebyoliver">Madebyoliver</a>,
<a href="http://www.flaticon.com/authors/pixel-buddha">Pixel Buddha</a>,
<a href="http://www.flaticon.com/authors/nikita-golubev">Nikita Golubev</a>,
<a href="http://www.flaticon.com/authors/maxim-basinski">Maxim Basinski</a>
from <a href="www.flaticon.com">www.flaticon.com</a>""")

        text = _("""<p align="center"><span style="font-size:15px;font-weight:bold;">MusicBrainz Picard</span><br/>
Version %(version)s</p>
<p align="center"><small>
%(third_parties_versions)s
</small></p>
<p align="center"><strong>Supported formats</strong><br/>%(formats)s</p>
<p align="center"><strong>Please donate</strong><br/>
Thank you for using Picard. Picard relies on the MusicBrainz database, which is operated by the MetaBrainz Foundation with the help of thousands of volunteers. If you like this application please consider donating to the MetaBrainz Foundation to keep the service running.</p>
<p align="center"><a href="%(picard-donate-url)s">Donate now!</a></p>
<p align="center"><strong>Credits</strong><br/>
<small>Copyright © %(copyright-years)s %(authors-credits)s and others%(translator-credits)s</small></p>
<p align="center"><small>%(icons-credits)s</small></p>
<p align="center"><strong>Official website</strong><br/><a href="%(picard-doc-url)s">%(picard-doc-url)s</a></p>
""") % args
        self.ui.label.setOpenExternalLinks(True)
        self.ui.label.setText(text)
Пример #4
0
    def _loading_finished(self, callback, result=None, error=None):
        if self.state != File.PENDING or self.tagger.stopping:
            return
        config = get_config()
        if error is not None:
            self.state = self.ERROR
            self.error_append(str(error))

            # If loading failed, force format guessing and try loading again
            from picard.formats.util import guess_format
            try:
                alternative_file = guess_format(self.filename)
            except (FileNotFoundError, OSError):
                log.error("Guessing format of %s failed",
                          self.filename,
                          exc_info=True)
                alternative_file = None

            if alternative_file:
                # Do not retry reloading exactly the same file format
                if type(alternative_file) != type(self):  # pylint: disable=unidiomatic-typecheck
                    log.debug('Loading %r failed, retrying as %r' %
                              (self, alternative_file))
                    self.remove()
                    alternative_file.load(callback)
                    return
                else:
                    alternative_file.remove()  # cleanup unused File object
            from picard.formats import supported_extensions
            file_name, file_extension = os.path.splitext(self.base_filename)
            if file_extension not in supported_extensions():
                log.error(
                    'Unsupported media file %r wrongly loaded. Removing ...',
                    self)
                callback(self, remove_file=True)
                return
        else:
            self.clear_errors()
            self.state = self.NORMAL
            postprocessors = []
            if config.setting["guess_tracknumber_and_title"]:
                postprocessors.append(self._guess_tracknumber_and_title)
            self._copy_loaded_metadata(result, postprocessors)
        # use cached fingerprint from file metadata
        if not config.setting["ignore_existing_acoustid_fingerprints"]:
            fingerprints = self.metadata.getall('acoustid_fingerprint')
            if fingerprints:
                self.set_acoustid_fingerprint(fingerprints[0])
        run_file_post_load_processors(self)
        self.update()
        callback(self)
Пример #5
0
 def _loading_finished(self, callback, result=None, error=None):
     if self.state != self.PENDING:
         return
     if error is not None:
         self.error = str(error)
         self.state = self.ERROR
         from picard.formats import supported_extensions
         file_name, file_extension = os.path.splitext(self.base_filename)
         if file_extension not in supported_extensions():
             self.remove()
             log.error('Unsupported media file %r wrongly loaded. Removing ...',self)
             return
     else:
         self.error = None
         self.state = self.NORMAL
         self._copy_loaded_metadata(result)
     self.update()
     callback(self)
Пример #6
0
 def _loading_finished(self, callback, result=None, error=None):
     if self.state != File.PENDING or self.tagger.stopping:
         return
     if error is not None:
         self.error = str(error)
         self.state = self.ERROR
         from picard.formats import supported_extensions
         file_name, file_extension = os.path.splitext(self.base_filename)
         if file_extension not in supported_extensions():
             self.remove()
             log.error('Unsupported media file %r wrongly loaded. Removing ...', self)
             return
     else:
         self.error = None
         self.state = self.NORMAL
         self._copy_loaded_metadata(result)
     self.update()
     callback(self)
Пример #7
0
    def load(self):
        args = {
            "picard-doc-url": PICARD_URLS['home'],
            "picard-donate-url": PICARD_URLS['donate'],
        }
        args.update(versions.as_dict(i18n=True))

        args["formats"] = ", ".join(
            map(lambda x: x[1:], supported_extensions()))

        # TR: Replace this with your name to have it appear in the "About" dialog.
        args["translator-credits"] = _("translator-credits")
        if args["translator-credits"] != "translator-credits":
            # TR: Replace LANG with language you are translatig to.
            args["translator-credits"] = _(
                "<br/>Translated to LANG by %s"
            ) % args["translator-credits"].replace("\n", "<br/>")
        else:
            args["translator-credits"] = ""

        args['third_parties_versions'] = '<br />'.join([
            u"%s %s" % (versions.version_name(name), value)
            for name, value in versions.as_dict(i18n=True).items()
            if name != 'version'
        ])
        text = _(
            u"""<p align="center"><span style="font-size:15px;font-weight:bold;">MusicBrainz Picard</span><br/>
Version %(version)s</p>
<p align="center"><small>
%(third_parties_versions)s
</small></p>
<p align="center"><strong>Supported formats</strong><br/>%(formats)s</p>
<p align="center"><strong>Please donate</strong><br/>
Thank you for using Picard. Picard relies on the MusicBrainz database, which is operated by the MetaBrainz Foundation with the help of thousands of volunteers. If you like this application please consider donating to the MetaBrainz Foundation to keep the service running.</p>
<p align="center"><a href="%(picard-donate-url)s">Donate now!</a></p>
<p align="center"><strong>Credits</strong><br/>
<small>Copyright © 2004-2017 Robert Kaye, Lukáš Lalinský, Laurent Monin and others%(translator-credits)s</small></p>
<p align="center"><strong>Official website</strong><br/><a href="%(picard-doc-url)s">%(picard-doc-url)s</a></p>
""") % args
        self.ui.label.setOpenExternalLinks(True)
        self.ui.label.setText(text)
Пример #8
0
    def load(self):
        args = {
            "picard-doc-url": PICARD_URLS['home'],
            "picard-donate-url": PICARD_URLS['donate'],
        }
        args.update(versions.as_dict(i18n=True))

        args["formats"] = ", ".join(map(lambda x: x[1:], supported_extensions()))

        # TR: Replace this with your name to have it appear in the "About" dialog.
        args["translator-credits"] = _("translator-credits")
        if args["translator-credits"] != "translator-credits":
            # TR: Replace LANG with language you are translatig to.
            args["translator-credits"] = _("<br/>Translated to LANG by %s") % args["translator-credits"].replace("\n", "<br/>")
        else:
            args["translator-credits"] = ""

        args['third_parties_versions'] = '<br />'.join(["%s %s" %
                                                        (versions.version_name(name), value) for name, value
                                                        in versions.as_dict(i18n=True).items()
                                                        if name != 'version'])
        text = _("""<p align="center"><span style="font-size:15px;font-weight:bold;">MusicBrainz Picard</span><br/>
Version %(version)s</p>
<p align="center"><small>
%(third_parties_versions)s
</small></p>
<p align="center"><strong>Supported formats</strong><br/>%(formats)s</p>
<p align="center"><strong>Please donate</strong><br/>
Thank you for using Picard. Picard relies on the MusicBrainz database, which is operated by the MetaBrainz Foundation with the help of thousands of volunteers. If you like this application please consider donating to the MetaBrainz Foundation to keep the service running.</p>
<p align="center"><a href="%(picard-donate-url)s">Donate now!</a></p>
<p align="center"><strong>Credits</strong><br/>
<small>Copyright © 2004-2017 Robert Kaye, Lukáš Lalinský, Laurent Monin, Sambhav Kothari and others%(translator-credits)s</small></p>
<p align="center"><strong>Official website</strong><br/><a href="%(picard-doc-url)s">%(picard-doc-url)s</a></p>
""") % args
        self.ui.label.setOpenExternalLinks(True)
        self.ui.label.setText(text)
Пример #9
0
    def _update_content(self):
        args = versions.as_dict(i18n=True)

        args['third_parties_versions'] = ', '.join([
            ("%s %s" % (versions.version_name(name), value)).replace(
                ' ', '&nbsp;').replace('-', '&#8209;')  # non-breaking hyphen
            for name, value in versions.as_dict(i18n=True).items()
            if name != 'version'
        ])

        args['formats'] = ", ".join(
            map(lambda x: x[1:], supported_extensions()))
        args['copyright_years'] = '2004-2021'
        args['authors_credits'] = ", ".join([
            'Robert Kaye',
            'Lukáš Lalinský',
            'Laurent Monin',
            'Sambhav Kothari',
            'Philipp Wolfer',
        ])

        # TR: Replace this with your name to have it appear in the "About" dialog.
        args["translator_credits"] = _("translator-credits")
        if args["translator_credits"] != "translator-credits":
            # TR: Replace LANG with language you are translating to.
            args["translator_credits"] = _(
                "<br/>Translated to LANG by %s"
            ) % args["translator_credits"].replace("\n", "<br/>")
        else:
            args["translator_credits"] = ""
        args['icons_credits'] = _(
            'Icons made by Sambhav Kothari <*****@*****.**> '
            'and <a href="http://www.flaticon.com/authors/madebyoliver">Madebyoliver</a>, '
            '<a href="http://www.flaticon.com/authors/pixel-buddha">Pixel Buddha</a>, '
            '<a href="http://www.flaticon.com/authors/nikita-golubev">Nikita Golubev</a>, '
            '<a href="http://www.flaticon.com/authors/maxim-basinski">Maxim Basinski</a>, '
            '<a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> '
            'from <a href="https://www.flaticon.com">www.flaticon.com</a>')

        def strong(s):
            return '<strong>' + s + '</strong>'

        def small(s):
            return '<small>' + s + '</small>'

        def url(url, s=None):
            if s is None:
                s = url
            return '<a href="%s">%s</a>' % (url, s)

        text_paragraphs = [
            strong(_("Version %(version)s")),
            small('%(third_parties_versions)s'),
            strong(_("Supported formats")), '%(formats)s',
            strong(_("Please donate")),
            _("Thank you for using Picard. Picard relies on the MusicBrainz database, which is operated by the "
              "MetaBrainz Foundation with the help of thousands of volunteers. If you like this application please "
              "consider donating to the MetaBrainz Foundation to keep the service running."
              ),
            url(PICARD_URLS['donate'], _("Donate now!")),
            strong(_("Credits")),
            small(
                _("Copyright © %(copyright_years)s %(authors_credits)s and others"
                  ) + "%(translator_credits)s"),
            small('%(icons_credits)s'),
            strong(_("Official website")),
            url(PICARD_URLS['home'])
        ]
        self.ui.label.setOpenExternalLinks(True)
        self.ui.label.setText("".join(
            ['<p align="center">' + p + "</p>"
             for p in text_paragraphs]) % args)