def callback(self, objs): cluster = objs[0] url = "http://www.google.com/search?hl=en&q=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"]) url += " " url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) webbrowser2.open(url)
def callback(self, objs): if len(objs) != 1 or not isinstance(objs[0], Cluster): return cluster = objs[0] artists = set() for i, file in enumerate(cluster.files): artists.add(file.metadata["artist"]) url = "http://musicbrainz.org/cdi/enter.html" if len(artists) > 1: url += "?hasmultipletrackartists=1&artistid=1" else: url += "?hasmultipletrackartists=0&artistid=2" url += "&artistedit=1&artistname=%s" % QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"]) url += "&releasename=%s" % QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) tracks = 0 for i, file in enumerate(cluster.files): try: i = int(file.metadata["tracknumber"]) - 1 except: pass tracks = max(tracks, i + 1) url += "&track%d=%s" % (i, QtCore.QUrl.toPercentEncoding(file.metadata["title"])) url += "&tracklength%d=%s" % (i, QtCore.QUrl.toPercentEncoding(format_time(file.metadata.length))) if len(artists) > 1: url += "&tr%d_artistedit=1" % i url += "&tr%d_artistname=%s" % (i, QtCore.QUrl.toPercentEncoding(file.metadata["artist"])) url += "&tracks=%d" % tracks webbrowser2.open(url)
def callback(self, objs): cluster = objs[0] url = "http://www.amazon.co.uk/s/?url=search-alias%3Dpopular&field-keywords=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"]) url += " " url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) webbrowser2.open(url)
def callback(self, objs): if len(objs) != 1 or not isinstance(objs[0], Cluster): return cluster = objs[0] (fd, fp) = tempfile.mkstemp(suffix=".html") f = codecs.getwriter("utf-8")(os.fdopen(fd, "w")) def esc(s): return "".join(HTML_ATTR_ESCAPE.get(c, c) for c in s) # add a global (release-level) name-value def nv(n, v): f.write(HTML_INPUT % (esc(n), esc(v))) f.write(HTML_HEAD) nv("artist_credit.names.0.artist.name", cluster.metadata["albumartist"]) nv("name", cluster.metadata["album"]) discnumber_shift = -1 for i, file in enumerate(cluster.files): try: i = int(file.metadata["tracknumber"]) - 1 except: pass # As per https://musicbrainz.org/doc/Development/Release_Editor_Seeding#Tracklists_and_Mediums # the medium numbers ("m") must be starting with 0. # Maybe the existing tags don't have disc numbers in them or # they're starting with something smaller than or equal to 0, so try # to produce a sane disc number. try: m = int(file.metadata.get("discnumber", 1)) if m <= 0: # A disc number was smaller than or equal to 0 - all other # disc numbers need to be changed to accommodate that. discnumber_shift = max(discnumber_shift, 0 - m) m = m + discnumber_shift except Exception as e: # The most likely reason for an exception at this point is a # ValueError because the disc number in the tags was not a # number. Just log the exception and assume the medium number # is 0. file.log.info("Trying to get the disc number of %s caused the following error: %s; assuming 0", file.filename, e) m = 0 # add a track-level name-value def tnv(n, v): nv("mediums.%d.track.%d.%s" % (m, i, n), v) tnv("name", file.metadata["title"]) if file.metadata["artist"] != cluster.metadata["albumartist"]: tnv("artist_credit.names.0.name", file.metadata["artist"]) tnv("length", str(file.metadata.length)) f.write(HTML_TAIL) f.close() webbrowser2.open("file://" + fp)
def show_item(self, item): data = item.data(QtCore.Qt.UserRole) # Check if this function isn't triggered by cell in Type column if isinstance(data, str): return filename = data.tempfile_filename if filename: webbrowser2.open("file://" + filename)
def callback(self, objs): cluster = objs[0] url = "http://www.discogs.com/search?type=all&q=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"]) url += "+" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) url += "&btn=Search" webbrowser2.open(url)
def _open_url_with_token(payload): token = jwt.encode(payload, __key, algorithm=__algorithm) if isinstance(token, bytes): # For compatibility with PyJWT 1.x token = token.decode() browser_integration = QCoreApplication.instance().browser_integration url = 'http://%s:%s/add?token=%s' % ( browser_integration.host_address, browser_integration.port, token) open(url)
def callback(self, objs, tld=tld): cluster = objs[0] url = urls[tld]['url'] url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) if tld == 'es': url += '.htm' if tld == 'vn': url += '.html' webbrowser2.open(url)
def login(self): scopes = "profile tag rating collection submit_isrc submit_barcode" authorization_url = self.tagger.xmlws.oauth_manager.get_authorization_url(scopes) webbrowser2.open(authorization_url) authorization_code, ok = QInputDialog.getText(self, _("MusicBrainz Account"), _("Authorization code:")) if ok: self.tagger.xmlws.oauth_manager.exchange_authorization_code( authorization_code, scopes, self.on_authorization_finished)
def open_amazon(self): # TODO: make this configurable store = "amazon.com" url = "http://%s/exec/obidos/ASIN/%s/%s?v=glance&s=music" % ( store, self.asin, AMAZON_STORE_ASSOCIATE_IDS[store], ) webbrowser2.open(url)
def callback(self, objs): cluster = objs[0] url = "http://musicbrainz.org/show/puid/?puid=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["musicip_puid"]) if len(cluster.metadata["musicip_puid"]) > 1: webbrowser2.open(url) else: global w w = NoPUID() w.show()
def callback(self, objs): for obj in objs: if isinstance(obj, Album) or isinstance(obj, Cluster): artist = obj.metadata['albumartist'] album = obj.metadata['album'] if isinstance(obj, Album): tracks = [track.metadata['title'] for track in obj.tracks] else: tracks = [file.metadata['title'] for file in obj.files] url = build_papercdcase_url(artist, album, tracks) webbrowser2.open(url)
def callback(self, objs): if len(objs) != 1 or not isinstance(objs[0], Cluster): return cluster = objs[0] url = "http://faux.no-ip.biz/mbreports/cueread2.php?" for i, file in enumerate(cluster.files): url += "%s=%s&" % (file.metadata["tracknumber"], file.metadata.length) webbrowser2.open(url)
def mb_login(self, callback, parent=None): scopes = "profile tag rating collection submit_isrc submit_barcode" authorization_url = self.webservice.oauth_manager.get_authorization_url( scopes) webbrowser2.open(authorization_url) authorization_code = self._mb_login_dialog(parent) if authorization_code is not None: self.webservice.oauth_manager.exchange_authorization_code( authorization_code, scopes, partial(self.on_mb_authorization_finished, callback)) else: callback(False, None)
def help(self): current_page = self.ui.pages_stack.currentWidget() url = current_page.HELP_URL # If URL is empty, use the first non empty parent help URL. while current_page.PARENT and not url: current_page = self.item_to_page[self.page_to_item[ current_page.PARENT]] url = current_page.HELP_URL if not url: url = DOCS_BASE_URL elif url.startswith('/'): url = DOCS_BASE_URL + url webbrowser2.open(url)
def mb_login(self, callback, parent=None): scopes = "profile tag rating collection submit_isrc submit_barcode" authorization_url = self.webservice.oauth_manager.get_authorization_url(scopes) webbrowser2.open(authorization_url) if not parent: parent = self.window authorization_code, ok = QtWidgets.QInputDialog.getText(parent, _("MusicBrainz Account"), _("Authorization code:")) if ok: self.webservice.oauth_manager.exchange_authorization_code( authorization_code, scopes, partial(self.on_mb_authorization_finished, callback)) else: callback(False)
def _display_results(self): # Display results to user. key = '' high_version = PICARD_VERSION for test_key in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[test_key]['name'] version_tuple = self._available_versions.get(update_level, {}).get( 'version', (0, 0, 0, '')) try: test_version = Version(*version_tuple) except (TypeError, VersionError): log.error('Invalid version %r for update level %s.' % (version_tuple, update_level)) continue if self._update_level >= test_key and test_version > high_version: key = PROGRAM_UPDATE_LEVELS[test_key]['name'] high_version = test_version if key: if QMessageBox.information( self._parent, _("Picard Update"), _("A new version of Picard is available.\n\n" "This version: {picard_old_version}\n" "New version: {picard_new_version}\n\n" "Would you like to download the new version?").format( picard_old_version=PICARD_FANCY_VERSION_STR, picard_new_version=self._available_versions[key] ['tag']), QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel, QMessageBox. StandardButton.Cancel) == QMessageBox.StandardButton.Ok: webbrowser2.open( self._available_versions[key]['urls']['download']) else: if self._show_always: if self._update_level in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[ self._update_level]['title'] else: update_level = N_('unknown') QMessageBox.information( self._parent, _("Picard Update"), _("There is no update currently available for your subscribed update level: {update_level}\n\n" "Your version: {picard_old_version}\n").format( update_level=_(update_level), picard_old_version=PICARD_FANCY_VERSION_STR, ), QMessageBox.StandardButton.Ok, QMessageBox.StandardButton.Ok)
def mb_login(self, callback, parent=None): scopes = "profile tag rating collection submit_isrc submit_barcode" authorization_url = self.webservice.oauth_manager.get_authorization_url(scopes) webbrowser2.open(authorization_url) if not parent: parent = self.window dialog = QtWidgets.QInputDialog(parent) dialog.setWindowModality(QtCore.Qt.WindowModal) dialog.setWindowTitle(_("MusicBrainz Account")) dialog.setLabelText(_("Authorization code:")) status = dialog.exec_() if status == QtWidgets.QDialog.Accepted: authorization_code = dialog.textValue() self.webservice.oauth_manager.exchange_authorization_code( authorization_code, scopes, partial(self.on_mb_authorization_finished, callback)) else: callback(False)
def callback(self, objs): if len(objs) != 1 or not isinstance(objs[0], Cluster): return cluster = objs[0] (fd, fp) = tempfile.mkstemp(suffix=".html") f = codecs.getwriter("utf-8")(os.fdopen(fd, "w")) def esc(s): return "".join(HTML_ATTR_ESCAPE.get(c, c) for c in s) # add a global (release-level) name-value def nv(n, v): f.write(HTML_INPUT % (esc(n), esc(v))) f.write(HTML_HEAD) nv("artist_credit.names.0.artist.name", cluster.metadata["albumartist"]) nv("name", cluster.metadata["album"]) for i, file in enumerate(cluster.files): try: i = int(file.metadata["tracknumber"]) - 1 except: pass try: m = int(file.metadata["discnumber"]) - 1 except: m = 0 # add a track-level name-value def tnv(n, v): nv("mediums.%d.track.%d.%s" % (m, i, n), v) tnv("name", file.metadata["title"]) if file.metadata["artist"] != cluster.metadata["albumartist"]: tnv("artist_credit.names.0.name", file.metadata["artist"]) tnv("length", str(file.metadata.length)) f.write(HTML_TAIL) f.close() webbrowser2.open("file://" + fp)
def _display_results(self): # Display results to user. key = '' high_version = PICARD_VERSION for test_key in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[test_key]['name'] test_version = self._available_versions.get(update_level, {}).get('version', (0, 0, 0, '')) if self._update_level >= test_key and compare_version_tuples(high_version, test_version) > 0: key = PROGRAM_UPDATE_LEVELS[test_key]['name'] high_version = test_version if key: if QMessageBox.information( self._parent, _("Picard Update"), _("A new version of Picard is available.\n\n" "This version: {picard_old_version}\n" "New version: {picard_new_version}\n\n" "Would you like to download the new version?").format( picard_old_version=PICARD_FANCY_VERSION_STR, picard_new_version=self._available_versions[key]['tag'] ), QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Cancel ) == QMessageBox.Ok: webbrowser2.open(self._available_versions[key]['urls']['download']) else: if self._show_always: if self._update_level in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[self._update_level]['title'] else: update_level = N_('unknown') QMessageBox.information( self._parent, _("Picard Update"), _("There is no update currently available for your subscribed update level: {update_level}\n\n" "Your version: {picard_old_version}\n").format( update_level=_(update_level), picard_old_version=PICARD_FANCY_VERSION_STR, ), QMessageBox.Ok, QMessageBox.Ok )
def _display_results(self): # Display results to user. key = '' high_version = PICARD_VERSION for test_key in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[test_key]['name'] test_version = self._available_versions.get(update_level, {}).get( 'version', (0, 0, 0, '')) if self._update_level >= test_key and compare_version_tuples( high_version, test_version) > 0: key = PROGRAM_UPDATE_LEVELS[test_key]['name'] high_version = test_version if key: if QMessageBox.information( self._parent, _("Picard Update"), _("A new version of Picard is available.\n\n" "This version: {picard_old_version}\n" "New version: {picard_new_version}\n\n" "Would you like to download the new version?").format( picard_old_version=PICARD_FANCY_VERSION_STR, picard_new_version=self._available_versions[key] ['tag']), QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Cancel) == QMessageBox.Ok: webbrowser2.open( self._available_versions[key]['urls']['download']) else: if self._show_always: if self._update_level in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[ self._update_level]['title'] else: update_level = N_('unknown') QMessageBox.information( self._parent, _("Picard Update"), _("There is no update currently available for your subscribed update level: {update_level}\n\n" "Your version: {picard_old_version}\n").format( update_level=_(update_level), picard_old_version=PICARD_FANCY_VERSION_STR, ), QMessageBox.Ok, QMessageBox.Ok)
def callback(self, objs): if len(objs) != 1 or not isinstance(objs[0], Cluster): return cluster = objs[0] artists = set() for i, file in enumerate(cluster.files): artists.add(file.metadata["artist"]) url = "http://musicbrainz.org/cdi/enter.html" if len(artists) > 1: url += "?hasmultipletrackartists=1&artistid=1" else: url += "?hasmultipletrackartists=0&artistid=2" url += "&artistedit=1&artistname=%s" % QtCore.QUrl.toPercentEncoding( cluster.metadata["artist"]) url += "&releasename=%s" % QtCore.QUrl.toPercentEncoding( cluster.metadata["album"]) tracks = 0 for i, file in enumerate(cluster.files): try: i = int(file.metadata["tracknumber"]) - 1 except: pass tracks = max(tracks, i + 1) url += "&track%d=%s" % ( i, QtCore.QUrl.toPercentEncoding(file.metadata["title"])) url += "&tracklength%d=%s" % (i, QtCore.QUrl.toPercentEncoding( format_time( file.metadata.length))) if len(artists) > 1: url += "&tr%d_artistedit=1" % i url += "&tr%d_artistname=%s" % ( i, QtCore.QUrl.toPercentEncoding(file.metadata["artist"])) url += "&tracks=%d" % tracks webbrowser2.open(url)
def callback(self, objs): cluster = objs[0] url = "http://www.filmmuziek.be/search.cgi?Match=0&Realm=All&Terms=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) webbrowser2.open(url)
def acousticbrainz_extractor_download(self): webbrowser2.open(ACOUSTICBRAINZ_DOWNLOAD_URL)
def open_html_file(self, fp): webbrowser2.open("file://" + fp)
def show_item(self, item): coverartimage = item.data(QtCore.Qt.UserRole) filename = coverartimage.tempfile_filename if filename: webbrowser2.open("file://" + filename)
def callback(self, objs): cluster = objs[0] url = "http://www.castalbums.org/shows/search/" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) webbrowser2.open(url)
def docs_browser(self): """Open the scriping documentation in a browser. """ webbrowser2.open('doc_scripting')
def open_bug_report(self): webbrowser2.open("http://musicbrainz.org/doc/Picard_Troubleshooting")
def open_release_page(self): host = self.config.setting["server_host"] port = self.config.setting["server_port"] url = "http://%s:%s/release/%s" % (host, port, self.release) webbrowser2.open(url)
def open_support_forum(self): webbrowser2.open("http://forums.musicbrainz.org/viewforum.php?id=2")
def callback(self, objs): cluster = objs[0] url = "http://www.gmronline.com/results.asp?display=0&go=Go+Find+It&searchType=Title&browseType=Title&results=25&search=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) webbrowser2.open(url)
def acoustid_fpcalc_download(self): webbrowser2.open("http://acoustid.org/chromaprint#download")
def open_donation_page(self): webbrowser2.open('http://metabrainz.org/donate')
def callback(self, objs): cluster = objs[0] url = "http://www.soundtrackcollector.com/catalog/search.php?searchon=all&searchtext=" url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"]) webbrowser2.open(url)
def launch(self, url): webbrowser2.open(url)
def show_help(self): webbrowser2.open("http://musicbrainz.org/doc/Picard_Documentation")
def launch(self, url): log.debug("webbrowser2: %s" % url) webbrowser2.open(url) return True
def open_release_page(self): host = config.setting["server_host"] port = config.setting["server_port"] url = "http://%s:%s/release/%s" % (host, port, self.release) webbrowser2.open(url)
def acoustid_apikey_get(self): webbrowser2.open("http://acoustid.org/api-key")
def help(self): webbrowser2.open('http://musicbrainz.org/doc/PicardDocumentation/Options')