[gnome-music/wip/libmediaart: 38/39] Port to libmediaart
- From: Arnel A. Borja <arnelborja src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/libmediaart: 38/39] Port to libmediaart
- Date: Tue, 15 Apr 2014 12:22:45 +0000 (UTC)
commit bb0ff97cdde0ffdf6d0c5129771c5c848a7a1bc4
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Tue Apr 1 23:18:27 2014 +0200
Port to libmediaart
configure.ac | 1 +
gnomemusic/albumArtCache.py | 20 +++++---------------
2 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d428131..5913784 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ PKG_PROG_PKG_CONFIG([0.22])
GLIB_GSETTINGS
GOBJECT_INTROSPECTION_REQUIRE([1.35.9])
PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.10])
+PKG_CHECK_MODULES(MEDIAART, [libmediaart-1.0], HAVE_MEDIAART=yes, HAVE_MEDIAART=no)
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
AC_SUBST(GLIB_COMPILE_RESOURCES)
diff --git a/gnomemusic/albumArtCache.py b/gnomemusic/albumArtCache.py
index e98d976..4877f29 100644
--- a/gnomemusic/albumArtCache.py
+++ b/gnomemusic/albumArtCache.py
@@ -28,7 +28,7 @@
# delete this exception statement from your version.
-from gi.repository import Gtk, GdkPixbuf, Gio, GLib, Grl, Gdk
+from gi.repository import Gtk, GdkPixbuf, Gio, GLib, Grl, Gdk, MediaArt
from gettext import gettext as _
import cairo
from math import pi
@@ -50,11 +50,10 @@ class LookupRequest:
self.callback = callback
self.data = data
self.path = ''
- self.key = ''
self.key_index = 0
self.icon_format = 'jpeg'
- self.artist = item.get_string(Grl.METADATA_KEY_ARTIST) or item.get_string(Grl.METADATA_KEY_AUTHOR)
- self.album = item.get_string(Grl.METADATA_KEY_ALBUM)
+ self.artist = item.get_string(Grl.METADATA_KEY_ARTIST) or item.get_string(Grl.METADATA_KEY_AUTHOR)
or ''
+ self.album = item.get_string(Grl.METADATA_KEY_ALBUM) or ''
self.started = False
@log
@@ -79,8 +78,7 @@ class LookupRequest:
self._on_try_load_finished(None)
return
- self.key = AlbumArtCache.get_default()._keybuilder_funcs[self.key_index].__call__(self.artist,
self.album)
- self.path = GLib.build_filenamev([AlbumArtCache.get_default().cacheDir, '%s.%s' % (self.key,
self.icon_format)])
+ self.path = MediaArt.get_path(self.artist, self.album, "album", None)[0]
f = Gio.File.new_for_path(self.path)
f.read_async(GLib.PRIORITY_DEFAULT, None, self._on_read_ready, None)
@@ -158,8 +156,7 @@ class GetUriRequest:
self.data = data
self.callbacks = []
self.path = ''
- self.key = AlbumArtCache.get_default()._keybuilder_funcs[0].__call__(artist, album)
- self.path = GLib.build_filenamev([AlbumArtCache.get_default().cacheDir, self.key])
+ self.path = MediaArt.get_path(artist, album, "album", None)[0]
self.stream = None
self.started = False
@@ -271,13 +268,6 @@ class AlbumArtCache:
self.frame_cache = {}
self.frame_lock = threading.Lock()
- self._keybuilder_funcs = [
- lambda artist, album: 'album-%s-%s' % (
- self._normalize_and_hash(artist), self._normalize_and_hash(album)),
- lambda artist, album: 'album-%s-%s' % (
- self._normalize_and_hash(album), self._normalize_and_hash(None))
- ]
-
try:
Gio.file_new_for_path(self.cacheDir).make_directory(None)
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]