Beispiel #1
0
def build_cache_path(artist, title):
	folder = gconf.client_get_default().get_string(gconf_keys['folder'])
	if folder is None or folder == "":
		folder = os.path.join(rb.user_cache_dir(), "lyrics")

	lyrics_folder = os.path.expanduser (folder)
	if not os.path.exists (lyrics_folder):
		os.mkdir (lyrics_folder)

	artist_folder = os.path.join(lyrics_folder, artist[:128])
	if not os.path.exists (artist_folder):
		os.mkdir (artist_folder)

	return os.path.join(artist_folder, title[:128] + '.lyric')
Beispiel #2
0
def build_cache_path(artist, title):
    folder = gconf.client_get_default().get_string(gconf_keys["folder"])
    if folder is None or folder == "":
        folder = os.path.join(rb.user_cache_dir(), "lyrics")

    lyrics_folder = os.path.expanduser(folder)
    if not os.path.exists(lyrics_folder):
        os.mkdir(lyrics_folder)

    artist_folder = os.path.join(lyrics_folder, artist[:128])
    if not os.path.exists(artist_folder):
        os.mkdir(artist_folder)

    return os.path.join(artist_folder, title[:128] + ".lyric")
Beispiel #3
0
    def __init__(self, name, path, refresh=-1, discard=-1, lifetime=-1):
        """
        Creates a new cache.  'name' is a symbolic name for the cache.
        'path' is either an absolute path to the cache directory, or a
        path relative to the user cache directory.
        'refresh' is the length of time for which cache entries are always
        considered valid.  'lifetime' is the maximum time an entry can live
        in the cache.  'discard' is the length of time for which a cache entry
        can go unused before being discarded.  These are all specified in days,
        with -1 meaning unlimited.
        """
        self.name = name
        if path.startswith("/"):
            self.path = path
        else:
            self.path = os.path.join(rb.user_cache_dir(), path)

        self.refresh = refresh
        self.discard = discard
        self.lifetime = lifetime
    def __init__(self, name, path, refresh=-1, discard=-1, lifetime=-1):
        """
        Creates a new cache.  'name' is a symbolic name for the cache.
        'path' is either an absolute path to the cache directory, or a
        path relative to the user cache directory.
        'refresh' is the length of time for which cache entries are always
        considered valid.  'lifetime' is the maximum time an entry can live
        in the cache.  'discard' is the length of time for which a cache entry
        can go unused before being discarded.  These are all specified in days,
        with -1 meaning unlimited.
        """
        self.name = name
        if path.startswith("/"):
            self.path = path
        else:
            self.path = os.path.join(rb.user_cache_dir(), path)

        self.refresh = refresh
        self.discard = discard
        self.lifetime = lifetime
Beispiel #5
0
	def set_entry (self, entry):
		if entry != self.current_entry:
			if entry is None:
				awn_icon_change(None)
			db = self.shell.get_property("db")
			self.current_entry = entry
			
			xtns = ["png", "jpg", "jpeg"]
			try:
				artwork = [
					filename
					for filename in glob("{directory}/covers/{artist} - {album}*".format(
						directory=rb.user_cache_dir(),
						artist=db.entry_get(entry, rhythmdb.PROP_ARTIST),
						album=db.entry_get(entry, rhythmdb.PROP_ALBUM)
					))
					if filename.split(".")[-1].lower() in xtns
				][0]
				awn_icon_change(artwork)
			except:
				awn_icon_change(None)
import xml
import urllib
import urlparse
import threading
import zipfile


magnatune_partner_id = "rhythmbox"

# URIs
magnatune_song_info_uri = gio.File(uri="http://magnatune.com/info/song_info_xml.zip")
magnatune_buy_album_uri = "https://magnatune.com/buy/choose?"
magnatune_api_download_uri = "http://%s:%[email protected]/buy/membership_free_dl_xml?"

magnatune_in_progress_dir = gio.File(path=rb.user_data_dir()).resolve_relative_path('magnatune')
magnatune_cache_dir = gio.File(path=rb.user_cache_dir()).resolve_relative_path('magnatune')

magnatune_song_info = os.path.join(magnatune_cache_dir.get_path(), 'song_info.xml')
magnatune_song_info_temp = os.path.join(magnatune_cache_dir.get_path(), 'song_info.zip.tmp')


class MagnatuneSource(rb.BrowserSource):
	__gproperties__ = {
		'plugin': (rb.Plugin, 'plugin', 'plugin', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
	}

	__client = gconf.client_get_default()


	def __init__(self):
		rb.BrowserSource.__init__(self, name=_("Magnatune"))
import urlparse
import threading
import zipfile

magnatune_partner_id = "rhythmbox"

# URIs
magnatune_song_info_uri = gio.File(
    uri="http://magnatune.com/info/song_info_xml.zip")
magnatune_buy_album_uri = "https://magnatune.com/buy/choose?"
magnatune_api_download_uri = "http://%s:%[email protected]/buy/membership_free_dl_xml?"

magnatune_in_progress_dir = gio.File(
    path=rb.user_data_dir()).resolve_relative_path('magnatune')
magnatune_cache_dir = gio.File(
    path=rb.user_cache_dir()).resolve_relative_path('magnatune')

magnatune_song_info = os.path.join(magnatune_cache_dir.get_path(),
                                   'song_info.xml')
magnatune_song_info_temp = os.path.join(magnatune_cache_dir.get_path(),
                                        'song_info.zip.tmp')


class MagnatuneSource(rb.BrowserSource):
    __gproperties__ = {
        'plugin': (rb.Plugin, 'plugin', 'plugin',
                   gobject.PARAM_WRITABLE | gobject.PARAM_CONSTRUCT_ONLY),
    }

    __client = gconf.client_get_default()
Beispiel #8
0
import itertools
import gobject

from PodcastCoverArtSearch import PodcastCoverArtSearch
from MusicBrainzCoverArtSearch import MusicBrainzCoverArtSearch
from LastFMCoverArtSearch import LastFMCoverArtSearch
from EmbeddedCoverArtSearch import EmbeddedCoverArtSearch
from LocalCoverArtSearch import LocalCoverArtSearch

from urllib import unquote, pathname2url

ART_SEARCHES_LOCAL = [LocalCoverArtSearch, EmbeddedCoverArtSearch]
ART_SEARCHES_REMOTE = [PodcastCoverArtSearch, LastFMCoverArtSearch, MusicBrainzCoverArtSearch]
OLD_ART_FOLDER = '~/.gnome2/rhythmbox/covers'

ART_FOLDER = os.path.join(rb.user_cache_dir(), 'covers')
ART_CACHE_EXTENSION_JPG = 'jpg'
ART_CACHE_EXTENSION_PNG = 'png'
ART_CACHE_EXTENSION_META = 'rb-meta'
ART_CACHE_FORMAT_JPG = 'jpeg'
ART_CACHE_FORMAT_PNG = 'png'
ART_CACHE_SETTINGS_JPG = {"quality": "100"}
ART_CACHE_SETTINGS_PNG = {"compression": "9"}

class TicketSystem:
	def __init__ (self):
		self.counter = itertools.count ()
		self.hash = {}
		self.dead = set ()

	def dump (self):
has_gnome_keyring = False

#try:
#	import gnomekeyring
#	has_gnome_keyring = True
#except:
#	pass


magnatune_partner_id = "rhythmbox"

# URIs
magnatune_song_info_uri = "http://magnatune.com/info/song_info_xml.zip"

magnatune_in_progress_dir = os.path.join(rb.user_data_dir(), 'magnatune')
magnatune_cache_dir = os.path.join(rb.user_cache_dir(), 'magnatune')

magnatune_song_info = os.path.join(magnatune_cache_dir, 'song_info.xml')
magnatune_song_info_temp = os.path.join(magnatune_cache_dir, 'song_info.zip.tmp')


ALBUM_ART_URL = 'http://www.magnatune.com/music/%s/%s/cover.jpg'

class MagnatuneSource(rb.BrowserSource):
	__gproperties__ = {
		'plugin': (rb.Plugin, 'plugin', 'plugin', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
	}

	__client = gconf.client_get_default()

import itertools
import gobject

from PodcastCoverArtSearch import PodcastCoverArtSearch
from MusicBrainzCoverArtSearch import MusicBrainzCoverArtSearch
from LastFMCoverArtSearch import LastFMCoverArtSearch
from EmbeddedCoverArtSearch import EmbeddedCoverArtSearch
from LocalCoverArtSearch import LocalCoverArtSearch

from urllib import unquote

ART_SEARCHES_LOCAL = [LocalCoverArtSearch, EmbeddedCoverArtSearch]
ART_SEARCHES_REMOTE = [PodcastCoverArtSearch, LastFMCoverArtSearch, MusicBrainzCoverArtSearch]
OLD_ART_FOLDER = '~/.gnome2/rhythmbox/covers'

ART_FOLDER = os.path.join(rb.user_cache_dir(), 'covers')
ART_CACHE_EXTENSION_JPG = 'jpg'
ART_CACHE_EXTENSION_PNG = 'png'
ART_CACHE_EXTENSION_META = 'rb-meta'
ART_CACHE_FORMAT_JPG = 'jpeg'
ART_CACHE_FORMAT_PNG = 'png'
ART_CACHE_SETTINGS_JPG = {"quality": "100"}
ART_CACHE_SETTINGS_PNG = {"compression": "9"}

class TicketSystem:
	def __init__ (self):
		self.counter = itertools.count ()
		self.hash = {}
		self.dead = set ()

	def dump (self):