Example #1
0
        def unzip_album():
            # just use the first library location
            library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
            library_location = Gio.file_new_for_uri(library['locations'][0])

            print("unzipping %s" % dest.get_path())
            album = zipfile.ZipFile(dest.get_path())
            for track in album.namelist():
                track_uri = library_location.resolve_relative_path(
                    track).get_uri()
                print("zip file entry: %s => %s" % (track, track_uri))

                track_uri = RB.sanitize_uri_for_filesystem(track_uri)
                RB.uri_create_parent_dirs(track_uri)

                track_out = Gio.file_new_for_uri(track_uri).create(
                    Gio.FileCreateFlags.NONE, None)
                if track_out is not None:
                    track_out.write(album.read(track), None)
                    track_out.close(None)
                    print("adding %s to library" % track_uri)
                    self.__db.add_uri(track_uri)

            album.close()
            remove_download_files()
Example #2
0
		def unzip_album():
			# just use the first library location
			library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
			library_location = Gio.file_new_for_uri(library['locations'][0])

			album = zipfile.ZipFile(dest.get_path())
			for track in album.namelist():
				track_uri = library_location.resolve_relative_path(track).get_uri()

				track_uri = RB.sanitize_uri_for_filesystem(track_uri)
				RB.uri_create_parent_dirs(track_uri)

				track_out = Gio.file_new_for_uri(track_uri).create()
				if track_out is not None:
					track_out.write(album.read(track))
					track_out.close()
					self.__db.add_uri(track_uri)

			album.close()
			remove_download_files()
Example #3
0
        def unzip_album():
            # just use the first library location
            library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
            library_location = Gio.file_new_for_uri(library['locations'][0])

            album = zipfile.ZipFile(dest.get_path())
            for track in album.namelist():
                track_uri = library_location.resolve_relative_path(
                    track).get_uri()

                track_uri = RB.sanitize_uri_for_filesystem(track_uri)
                RB.uri_create_parent_dirs(track_uri)

                track_out = Gio.file_new_for_uri(track_uri).create()
                if track_out is not None:
                    track_out.write(album.read(track))
                    track_out.close()
                    self.__db.add_uri(track_uri)

            album.close()
            remove_download_files()
Example #4
0
		def unzip_album():
			# just use the first library location
			library = Gio.Settings.new("org.gnome.rhythmbox.rhythmdb")
			library_location = Gio.file_new_for_uri(library['locations'][0])

			print("unzipping %s" % dest.get_path())
			album = zipfile.ZipFile(dest.get_path())
			for track in album.namelist():
				track_uri = library_location.resolve_relative_path(track).get_uri()
				print("zip file entry: %s => %s" % (track, track_uri))

				track_uri = RB.sanitize_uri_for_filesystem(track_uri)
				RB.uri_create_parent_dirs(track_uri)

				track_out = Gio.file_new_for_uri(track_uri).create(Gio.FileCreateFlags.NONE, None)
				if track_out is not None:
					track_out.write(album.read(track), None)
					track_out.close(None)
					print("adding %s to library" % track_uri)
					self.__db.add_uri(track_uri)

			album.close()
			remove_download_files()