Example #1
0
			def download_finished(uri, result):
				try:
					success = uri.copy_finish(result)
				except:
					success = False

				if not success:
					return

				# done downloading, unzip to real location
				catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
				catalog = open(magnatune_song_info, 'w')
				filename = find_song_info(catalog_zip)
				if filename is None:
					RB.error_dialog(title=_("Unable to load catalog"),
							message=_("Rhythmbox could not understand the Magnatune catalog, please file a bug."))
					return
				catalog.write(catalog_zip.read(filename))
				catalog.close()
				catalog_zip.close()

				dest.delete()
				self.__updating = False
				self.__catalogue_loader = None
				self.__notify_status_changed()

				load_catalogue()
Example #2
0
	def __auth_download(self, sku): # http://magnatune.com/info/api

		def auth_data_cb(data, (username, password)):
			dl_album_handler = DownloadAlbumHandler(self.__settings['format'])
			auth_parser = xml.sax.make_parser()
			auth_parser.setContentHandler(dl_album_handler)

			if data is None:
				# hmm.
				return

			try:
				data = data.replace("<br>", "") # get rid of any stray <br> tags that will mess up the parser
				data = data.replace(" & ", " &amp; ") # clean up some missing escaping
				# print data
				auth_parser.feed(data)
				auth_parser.close()

				# process the URI: add authentication info, quote the filename component for some reason
				parsed = urlparse.urlparse(dl_album_handler.url)
				netloc = "%s:%s@%s" % (username, password, parsed.hostname)

				spath = os.path.split(urllib.url2pathname(parsed.path))
				basename = spath[1]
				path = urllib.pathname2url(os.path.join(spath[0], urllib.quote(basename)))

				authed = (parsed[0], netloc, path) + parsed[3:]
				audio_dl_uri = urlparse.urlunparse(authed)

				print "download uri for %s is %s" % (sku, audio_dl_uri)
				self.__download_album(audio_dl_uri, sku)

			except MagnatuneDownloadError, e:
				RB.error_dialog(title = _("Download Error"),
						message = _("An error occurred while trying to authorize the download.\nThe Magnatune server returned:\n%s") % str(e))
Example #3
0
    def __init__(self, shell):
        # make sure the replaygain elements are available
        missing = []
        required = ("rgvolume", "rglimiter")
        for e in required:
            if Gst.ElementFactory.find(e) is None:
                missing.append(e)

        if len(missing) > 0:
            msg = _(
                "The GStreamer elements required for ReplayGain processing are not available. The missing elements are: %s"
            ) % ", ".join(missing)
            RB.error_dialog(shell.props.window,
                            _("ReplayGain GStreamer plugins not available"),
                            msg)
            raise Exception(msg)

        self.shell_player = shell.props.shell_player
        self.player = self.shell_player.props.player
        self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.replaygain")

        self.settings.connect("changed::limiter", self.limiter_changed_cb)

        self.previous_gain = []
        self.fallback_gain = 0.0
        self.resetting_rgvolume = False

        # we use different means to hook into the playback pipeline depending on
        # the playback backend in use
        if GObject.signal_lookup("get-stream-filters", self.player):
            self.setup_xfade_mode()
            self.deactivate_backend = self.deactivate_xfade_mode
        else:
            self.setup_playbin2_mode()
            self.deactivate_backend = self.deactivate_playbin2_mode
Example #4
0
	def __init__(self, shell):
		# make sure the replaygain elements are available
		missing = []
		required = ("rgvolume", "rglimiter")
		for e in required:
			if Gst.ElementFactory.find(e) is None:
				missing.append(e)

		if len(missing) > 0:
			msg = _("The GStreamer elements required for ReplayGain processing are not available. The missing elements are: %s") % ", ".join(missing)
			RB.error_dialog(shell.props.window, _("ReplayGain GStreamer plugins not available"), msg)
			raise Exception(msg)

		self.shell_player = shell.props.shell_player
		self.player = self.shell_player.props.player
		self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.replaygain")

		self.settings.connect("changed::limiter", self.limiter_changed_cb)

		self.previous_gain = []
		self.fallback_gain = 0.0
		self.resetting_rgvolume = False

		# we use different means to hook into the playback pipeline depending on
		# the playback backend in use
		if GObject.signal_lookup("get-stream-filters", self.player):
			self.setup_xfade_mode()
			self.deactivate_backend = self.deactivate_xfade_mode
		else:
			self.setup_playbin2_mode()
			self.deactivate_backend = self.deactivate_playbin2_mode
                        def songs_loaded_cb(file, result, data):
                                try:
                                        (ok, contents, etag) = file.load_contents_finish(result)
                                except Exception as e:
                                        RB.error_dialog(
                                                title=_("Unable to load songs"),
                                                message=_("Rhythmbox could not load the Ampache songs."))
                                        return

                                try:
                                        # instantiate songs parser
                                        parser = xml.sax.make_parser()
                                        parser.setContentHandler(
                                                SongsHandler(
                                                        is_playlist,
                                                        source,
                                                        self.__db,
                                                        self.__entry_type,
                                                        self.__albumart,
                                                        self.__handshake_auth,
                                                        self.__entries))

                                        parser.feed(contents)
                                except xml.sax.SAXParseException as e:
                                        print("error parsing songs: %s" % e)

                                self.__text = ''
                                self.__progress = 1
                                self.notify_status_changed()

                                # load next cache
                                load_iterate()
Example #6
0
			def download_finished(copy, success, self):
				if not success:
					print("catalog download failed")
					print(copy.get_error())
					return

				print("catalog download successful")
				# done downloading, unzip to real location
				catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
				catalog = open(magnatune_song_info, 'wb')
				filename = find_song_info(catalog_zip)
				if filename is None:
					RB.error_dialog(title=_("Unable to load catalog"),
							message=_("Rhythmbox could not understand the Magnatune catalog, please file a bug."))
					return
				catalog.write(catalog_zip.read(filename))
				catalog.close()
				catalog_zip.close()

				df = Gio.file_new_for_path(magnatune_song_info_temp)
				df.delete(None)
				self.__catalogue_loader = None

				self.__load_progress.props.task_outcome = RB.TaskOutcome.COMPLETE

				load_catalogue()
Example #7
0
    def download_album(self):
        if self.__settings['account-type'] != 'download':
            # The user doesn't have a download account, so redirect them to the download signup page
            self.download_redirect()
            return

        try:
            # Just use the first library location
            library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
            library_location = library['locations'][0]
        except IndexError as e:
            RB.error_dialog(
                title=_("Couldn't download album"),
                message=_(
                    "You must have a library location set to download an album."
                ))
            return

        tracks = self.get_entry_view().get_selected_entries()
        skus = []

        for track in tracks:
            sku = self.__sku_dict[track.get_string(
                RB.RhythmDBPropType.LOCATION)]
            if sku in skus:
                continue
            skus.append(sku)
            self.__auth_download(sku)
            def songs_loaded_cb(file, result, data):
                try:
                    (ok, contents, etag) = file.load_contents_finish(result)
                except Exception as e:
                    RB.error_dialog(
                        title=_("Unable to load songs"),
                        message=_(
                            "Rhythmbox could not load the Ampache songs."))
                    return

                try:
                    # instantiate songs parser
                    parser = xml.sax.make_parser()
                    parser.setContentHandler(
                        SongsHandler(is_playlist, source, self.__db,
                                     self.__entry_type, self.__albumart,
                                     self.__handshake_auth, self.__entries))

                    parser.feed(contents)
                except xml.sax.SAXParseException as e:
                    print("error parsing songs: %s" % e)

                self.__text = ''
                self.__progress = 1
                self.notify_status_changed()

                # load next cache
                load_iterate()
Example #9
0
            def got_items(result, items):
                account_type = self.__settings['account_type']
                username = ""
                password = ""
                if account_type == 'none':
                    pass
                elif result is not None or len(items) == 0:
                    RB.error_dialog(title=_("Couldn't get account details"),
                                    message=str(result))
                    return
                else:
                    try:
                        username, password = items[0].secret.split('\n')
                    except ValueError:  # Couldn't parse secret, possibly because it's empty
                        pass
                parser = xml.sax.make_parser()
                parser.setContentHandler(
                    TrackListHandler(self.__db, self.__entry_type,
                                     self.__sku_dict, self.__home_dict,
                                     self.__art_dict, account_type, username,
                                     password))

                self.__catalogue_loader = rb.ChunkLoader()
                self.__catalogue_loader.get_url_chunks(magnatune_song_info,
                                                       64 * 1024, True,
                                                       catalogue_chunk_cb,
                                                       parser)
Example #10
0
            def download_finished(copy, success, self):
                if not success:
                    print("catalog download failed")
                    print(copy.get_error())
                    return

                print("catalog download successful")
                # done downloading, unzip to real location
                catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
                catalog = open(magnatune_song_info, 'wb')
                filename = find_song_info(catalog_zip)
                if filename is None:
                    RB.error_dialog(
                        title=_("Unable to load catalog"),
                        message=
                        _("Rhythmbox could not understand the Magnatune catalog, please file a bug."
                          ))
                    return
                catalog.write(catalog_zip.read(filename))
                catalog.close()
                catalog_zip.close()

                df = Gio.file_new_for_path(magnatune_song_info_temp)
                df.delete(None)
                self.__catalogue_loader = None

                self.__load_progress.props.task_outcome = RB.TaskOutcome.COMPLETE

                load_catalogue()
Example #11
0
            def download_finished(uri, result):
                try:
                    success = uri.copy_finish(result)
                except:
                    success = False

                if not success:
                    return

                # done downloading, unzip to real location
                catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
                catalog = open(magnatune_song_info, 'w')
                filename = find_song_info(catalog_zip)
                if filename is None:
                    RB.error_dialog(
                        title=_("Unable to load catalog"),
                        message=
                        _("Rhythmbox could not understand the Magnatune catalog, please file a bug."
                          ))
                    return
                catalog.write(catalog_zip.read(filename))
                catalog.close()
                catalog_zip.close()

                dest.delete()
                self.__updating = False
                self.__catalogue_loader = None
                self.__notify_status_changed()

                load_catalogue()
Example #12
0
            def download_finished(copy, success, self):
                if not success:
                    print "catalog download failed"
                    print copy.get_error()
                    return

                print "catalog download successful"
                # done downloading, unzip to real location
                catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
                catalog = open(magnatune_song_info, "w")
                filename = find_song_info(catalog_zip)
                if filename is None:
                    RB.error_dialog(
                        title=_("Unable to load catalog"),
                        message=_("Rhythmbox could not understand the Magnatune catalog, please file a bug."),
                    )
                    return
                catalog.write(catalog_zip.read(filename))
                catalog.close()
                catalog_zip.close()

                df = Gio.file_new_for_path(magnatune_song_info_temp)
                df.delete(None)
                self.__updating = False
                self.__catalogue_loader = None
                self.__notify_status_changed()

                load_catalogue()
            def download_finished(copy, success, self):
                if not success:
                    print "catalog download failed"
                    print copy.get_error()
                    return

                print "catalog download successful"
                # done downloading, unzip to real location
                catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
                catalog = open(magnatune_song_info, 'w')
                filename = find_song_info(catalog_zip)
                if filename is None:
                    RB.error_dialog(
                        title=_("Unable to load catalog"),
                        message=
                        _("Rhythmbox could not understand the Magnatune catalog, please file a bug."
                          ))
                    return
                catalog.write(catalog_zip.read(filename))
                catalog.close()
                catalog_zip.close()

                df = Gio.file_new_for_path(magnatune_song_info_temp)
                df.delete(None)
                self.__updating = False
                self.__catalogue_loader = None
                self.__notify_status_changed()

                load_catalogue()
Example #14
0
 def songs_loaded_cb(file, result, data):
     try:
         (ok, contents, etag) = file.load_contents_finish(result)
     except Exception, e:
         RB.error_dialog(
             title=_("Unable to load songs"),
             message=_(
                 "Rhythmbox could not load the Ampache songs."))
         return
Example #15
0
    def __auth_download(self, sku):  # http://magnatune.com/info/api
        def got_items(result, items):
            if result is not None or len(items) == 0:
                RB.error_dialog(title=_("Couldn't get account details"),
                                message=str(result))
                return

            try:
                username, password = items[0].secret.split('\n')
            except ValueError:  # Couldn't parse secret, possibly because it's empty
                username = ""
                password = ""
            print "downloading album: " + sku
            url_dict = {'id': magnatune_partner_id, 'sku': sku}
            url = magnatune_api_download_uri % (username, password)
            url = url + urllib.urlencode(url_dict)

            l = rb.Loader()
            l.get_url(url, auth_data_cb, (username, password))

        def auth_data_cb(data, (username, password)):
            buy_album_handler = BuyAlbumHandler(self.__settings['format'])
            auth_parser = xml.sax.make_parser()
            auth_parser.setContentHandler(buy_album_handler)

            if data is None:
                # hmm.
                return

            try:
                data = data.replace(
                    "<br>", ""
                )  # get rid of any stray <br> tags that will mess up the parser
                # print data
                auth_parser.feed(data)
                auth_parser.close()

                # process the URI: add authentication info, quote the filename component for some reason
                parsed = urlparse.urlparse(buy_album_handler.url)
                netloc = "%s:%s@%s" % (username, password, parsed.hostname)

                spath = os.path.split(urllib.url2pathname(parsed.path))
                basename = spath[1]
                path = urllib.pathname2url(
                    os.path.join(spath[0], urllib.quote(basename)))

                authed = (parsed[0], netloc, path) + parsed[3:]
                audio_dl_uri = urlparse.urlunparse(authed)

                self.__download_album(Gio.file_new_for_uri(audio_dl_uri), sku)

            except MagnatunePurchaseError, e:
                RB.error_dialog(
                    title=_("Download Error"),
                    message=
                    _("An error occurred while trying to authorize the download.\nThe Magnatune server returned:\n%s"
                      ) % str(e))
Example #16
0
	def __auth_download(self, sku): # http://magnatune.com/info/api
		def got_items(result, items):
			if result is not None or len(items) == 0:
				RB.error_dialog(title = _("Couldn't get account details"),
				                message = str(result))
				return

			try:
				username, password = items[0].secret.split('\n')
			except ValueError: # Couldn't parse secret, possibly because it's empty
				username = ""
				password = ""
			print "downloading album: " + sku
			url_dict = {
				'id':	magnatune_partner_id,
				'sku':	sku
			}
			url = magnatune_api_download_uri % (username, password)
			url = url + urllib.urlencode(url_dict)

			l = rb.Loader()
			l.get_url(url, auth_data_cb, (username, password))

		def auth_data_cb(data, (username, password)):
			buy_album_handler = BuyAlbumHandler(self.__settings['format'])
			auth_parser = xml.sax.make_parser()
			auth_parser.setContentHandler(buy_album_handler)

			if data is None:
				# hmm.
				return

			try:
				data = data.replace("<br>", "") # get rid of any stray <br> tags that will mess up the parser
				# print data
				auth_parser.feed(data)
				auth_parser.close()

				# process the URI: add authentication info, quote the filename component for some reason
				parsed = urlparse.urlparse(buy_album_handler.url)
				netloc = "%s:%s@%s" % (username, password, parsed.hostname)

				spath = os.path.split(urllib.url2pathname(parsed.path))
				basename = spath[1]
				path = urllib.pathname2url(os.path.join(spath[0], urllib.quote(basename)))

				authed = (parsed[0], netloc, path) + parsed[3:]
				audio_dl_uri = urlparse.urlunparse(authed)

				self.__download_album(Gio.file_new_for_uri(audio_dl_uri), sku)

			except MagnatunePurchaseError, e:
				RB.error_dialog(title = _("Download Error"),
						message = _("An error occurred while trying to authorize the download.\nThe Magnatune server returned:\n%s") % str(e))
Example #17
0
		def close_button_pressed(x, y):
			try:
				if keyring_data['id'] and keyring_data['item']:
					# The async version is not in the python bindings, grr...
					keyring.item_set_info_sync(None, keyring_data['id'], keyring_data['item'])
				else:
					RB.error_dialog(title = _("Couldn't store account information"),
							message = _("There was a problem accessing the keyring. Check the debug output for more information."))
			except Exception, e:
				RB.error_dialog(title = _("Couldn't store account information"),
						message = str(e))
Example #18
0
	def download_album(self):
		if selt.__settings['account_type'] != 'download':
			# The user doesn't have a download account, so redirect them to the purchase page.
			self.purchase_redirect()
			return

		try:
			# Just use the first library location
			library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
			library_location = library['locations'][0]
		except IndexError, e:
			RB.error_dialog(title = _("Couldn't purchase album"),
				        message = _("You must have a library location set to purchase an album."))
			return
Example #19
0
        def auth_data_cb(data, userpass):
            (username, password) = userpass
            dl_album_handler = DownloadAlbumHandler(self.__settings['format'])
            auth_parser = xml.sax.make_parser()
            auth_parser.setContentHandler(dl_album_handler)

            if data is None:
                # hmm.
                return

            try:
                data = data.decode("utf-8")
                data = data.replace(
                    "<br>", ""
                )  # get rid of any stray <br> tags that will mess up the parser
                data = data.replace(
                    " & ", " &amp; ")  # clean up some missing escaping
                # print data
                auth_parser.feed(data)
                auth_parser.close()

                # process the URI: add authentication info, quote the filename component for some reason
                parsed = urllib.parse.urlparse(dl_album_handler.url)
                netloc = "%s:%s@%s" % (username, password, parsed.hostname)

                spath = os.path.split(urllib.request.url2pathname(parsed.path))
                basename = spath[1]
                path = urllib.request.pathname2url(
                    os.path.join(spath[0], urllib.parse.quote(basename)))

                authed = (parsed[0], netloc, path) + parsed[3:]
                audio_dl_uri = urllib.parse.urlunparse(authed)

                print("download uri for %s is %s" % (sku, audio_dl_uri))
                self.__download_album(audio_dl_uri, sku)

            except MagnatuneDownloadError as e:
                RB.error_dialog(
                    title=_("Download Error"),
                    message=
                    _("An error occurred while trying to authorize the download.\nThe Magnatune server returned:\n%s"
                      ) % str(e))
            except Exception as e:
                sys.excepthook(*sys.exc_info())
                RB.error_dialog(
                    title=_("Error"),
                    message=
                    _("An error occurred while trying to download the album.\nThe error text is:\n%s"
                      ) % str(e))
Example #20
0
 def close_button_pressed(x, y):
     try:
         if keyring_data['id'] and keyring_data['item']:
             # The async version is not in the python bindings, grr...
             keyring.item_set_info_sync(None, keyring_data['id'],
                                        keyring_data['item'])
         else:
             RB.error_dialog(
                 title=_("Couldn't store account information"),
                 message=
                 _("There was a problem accessing the keyring. Check the debug output for more information."
                   ))
     except Exception, e:
         RB.error_dialog(title=_("Couldn't store account information"),
                         message=str(e))
Example #21
0
    def download_album(self):
        if self.__settings["account-type"] != "download":
            # The user doesn't have a download account, so redirect them to the download signup page
            self.download_redirect()
            return

        try:
            # Just use the first library location
            library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
            library_location = library["locations"][0]
        except IndexError, e:
            RB.error_dialog(
                title=_("Couldn't download album"),
                message=_("You must have a library location set to download an album."),
            )
            return
    def download_album(self):
        if self.__settings['account-type'] != 'download':
            # The user doesn't have a download account, so redirect them to the download signup page
            self.download_redirect()
            return

        try:
            # Just use the first library location
            library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
            library_location = library['locations'][0]
        except IndexError, e:
            RB.error_dialog(
                title=_("Couldn't download album"),
                message=_(
                    "You must have a library location set to download an album."
                ))
            return
Example #23
0
        def got_items(result, items):
            if result is not None or len(items) == 0:
                RB.error_dialog(title=_("Couldn't get account details"),
                                message=str(result))
                return

            try:
                username, password = items[0].secret.split('\n')
            except ValueError:  # Couldn't parse secret, possibly because it's empty
                username = ""
                password = ""
            print "downloading album: " + sku
            url_dict = {'id': magnatune_partner_id, 'sku': sku}
            url = magnatune_api_download_uri % (username, password)
            url = url + urllib.urlencode(url_dict)

            l = rb.Loader()
            l.get_url(url, auth_data_cb, (username, password))
Example #24
0
			def got_items(result, items):
				account_type = self.__settings['account_type']
				username = ""
				password = ""
				if account_type == 'none':
					pass
				elif result is not None or len(items) == 0:
					RB.error_dialog(title = _("Couldn't get account details"),
							message = str(result))
					return
				else:
					try:
						username, password = items[0].secret.split('\n')
					except ValueError: # Couldn't parse secret, possibly because it's empty
						pass
				parser = xml.sax.make_parser()
				parser.setContentHandler(TrackListHandler(self.__db, self.__entry_type, self.__sku_dict, self.__home_dict, self.__art_dict, account_type, username, password))

				self.__catalogue_loader = rb.ChunkLoader()
				self.__catalogue_loader.get_url_chunks(magnatune_song_info, 64*1024, True, catalogue_chunk_cb, parser)
Example #25
0
		def got_items(result, items):
			if result is not None or len(items) == 0:
				RB.error_dialog(title = _("Couldn't get account details"),
				                message = str(result))
				return

			try:
				username, password = items[0].secret.split('\n')
			except ValueError: # Couldn't parse secret, possibly because it's empty
				username = ""
				password = ""
			print "downloading album: " + sku
			url_dict = {
				'id':	magnatune_partner_id,
				'sku':	sku
			}
			url = magnatune_api_download_uri % (username, password)
			url = url + urllib.urlencode(url_dict)

			l = rb.Loader()
			l.get_url(url, auth_data_cb, (username, password))
Example #26
0
	def download_album(self):
		if self.__settings['account-type'] != 'download':
			# The user doesn't have a download account, so redirect them to the download signup page
			self.download_redirect()
			return

		try:
			# Just use the first library location
			library = Gio.Settings.new("org.gnome.rhythmbox.rhythmdb")
			library_location = library['locations'][0]
		except IndexError as e:
			RB.error_dialog(title = _("Couldn't download album"),
				        message = _("You must have a library location set to download an album."))
			return

		tracks = self.get_entry_view().get_selected_entries()
		skus = []

		for track in tracks:
			sku = self.__sku_dict[track.get_string(RB.RhythmDBPropType.LOCATION)]
			if sku in skus:
				continue
			skus.append(sku)
			self.__auth_download(sku)
Example #27
0
				netloc = "%s:%s@%s" % (username, password, parsed.hostname)

				spath = os.path.split(urllib.url2pathname(parsed.path))
				basename = spath[1]
				path = urllib.pathname2url(os.path.join(spath[0], urllib.quote(basename)))

				authed = (parsed[0], netloc, path) + parsed[3:]
				audio_dl_uri = urlparse.urlunparse(authed)

				self.__download_album(Gio.file_new_for_uri(audio_dl_uri), sku)

			except MagnatunePurchaseError, e:
				RB.error_dialog(title = _("Download Error"),
						message = _("An error occurred while trying to authorize the download.\nThe Magnatune server returned:\n%s") % str(e))
			except Exception, e:
				RB.error_dialog(title = _("Error"),
						message = _("An error occurred while trying to download the album.\nThe error text is:\n%s") % str(e))


		keyring.find_items(keyring.ITEM_GENERIC_SECRET, {'rhythmbox-plugin': 'magnatune'}, got_items)

	def __download_album(self, audio_dl_uri, sku):
		def download_progress(current, total):
			self.__downloads[str_uri] = (current, total)
			self.__notify_status_changed()

		def download_finished(uri, result):
			del self.__cancellables[str_uri]
			del self.__downloads[str_uri]

			try:
				success = uri.copy_finish(result)
                audio_dl_uri = urlparse.urlunparse(authed)

                print "download uri for %s is %s" % (sku, audio_dl_uri)
                self.__download_album(audio_dl_uri, sku)

            except MagnatuneDownloadError, e:
                RB.error_dialog(
                    title=_("Download Error"),
                    message=
                    _("An error occurred while trying to authorize the download.\nThe Magnatune server returned:\n%s"
                      ) % str(e))
            except Exception, e:
                sys.excepthook(*sys.exc_info())
                RB.error_dialog(
                    title=_("Error"),
                    message=
                    _("An error occurred while trying to download the album.\nThe error text is:\n%s"
                      ) % str(e))

        print "downloading album: " + sku
        account = MagnatuneAccount.instance()
        (account_type, username, password) = account.get()
        url_dict = {'id': magnatune_partner_id, 'sku': sku}
        url = magnatune_api_download_uri % (username, password)
        url = url + urllib.urlencode(url_dict)

        l = rb.Loader()
        l.get_url(url, auth_data_cb, (username, password))

    def __download_album(self, audio_dl_uri, sku):
        def download_progress(copy, complete, total, self):