summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaciag.artur <maciag.artur@0805d722-a2c2-11dd-9b86-41075523de00>2008-11-22 01:51:21 +0000
committermaciag.artur <maciag.artur@0805d722-a2c2-11dd-9b86-41075523de00>2008-11-22 01:51:21 +0000
commitdd1d1cd3588329bdfb296083686a666a0cf34fa4 (patch)
treedfd0f29a2b5a1f8ae03d358363debab4e159f37b
parentcherokee-0.10.1 (diff)
downloadpiczu-dd1d1cd3588329bdfb296083686a666a0cf34fa4.tar.gz
piczu-dd1d1cd3588329bdfb296083686a666a0cf34fa4.tar.bz2
piczu-dd1d1cd3588329bdfb296083686a666a0cf34fa4.zip
sonata-9999 with zeroconf/avahi support
git-svn-id: http://piczu-overlay.googlecode.com/svn/trunk@24 0805d722-a2c2-11dd-9b86-41075523de00
-rw-r--r--media-sound/sonata/Manifest2
-rw-r--r--media-sound/sonata/files/sonata-zeroconf-support.patch153
-rw-r--r--media-sound/sonata/sonata-9999.ebuild31
3 files changed, 186 insertions, 0 deletions
diff --git a/media-sound/sonata/Manifest b/media-sound/sonata/Manifest
new file mode 100644
index 0000000..140d536
--- /dev/null
+++ b/media-sound/sonata/Manifest
@@ -0,0 +1,2 @@
+AUX sonata-zeroconf-support.patch 6674 RMD160 ce8ed49faab5bcf17dd7c33eb1d1d4fc6909347e SHA1 d860895ead2a781844f0ad30dfb33169c82b98d9 SHA256 d3bebdac381159876b225fe2c0b263eba0884644510aeb925b818cda8e8c1f1d
+EBUILD sonata-9999.ebuild 875 RMD160 4c560d7cbd6881c61dd3bb9011029a84337f9f5e SHA1 5ad17743b7f39370f03bc03ffaecf388e3e82df2 SHA256 6202243f9f23e925cd1ede1dee201cde6eaa7fc835e18afac4f3c51b4b345d3d
diff --git a/media-sound/sonata/files/sonata-zeroconf-support.patch b/media-sound/sonata/files/sonata-zeroconf-support.patch
new file mode 100644
index 0000000..b5adc4b
--- /dev/null
+++ b/media-sound/sonata/files/sonata-zeroconf-support.patch
@@ -0,0 +1,153 @@
+--- sonata/main.py.orig 2008-11-22 01:40:44.000000000 +0100
++++ sonata/main.py 2008-11-22 01:44:34.000000000 +0100
+@@ -88,6 +88,16 @@
+ except:
+ HAVE_DBUS = False
+
++try:
++ if HAVE_DBUS:
++ import avahi
++ HAVE_AVAHI = True
++ AVAHI_TYPE = '_mpd._tcp'
++ else:
++ raise ImportError
++except:
++ HAVE_AVAHI = False
++
+ if not skip_gui:
+ import warnings, gobject, urllib, urllib2, re, gc, locale, shutil
+ import gtk, pango, threading, time, ui, img, tray
+@@ -626,6 +636,9 @@
+ uiDescription = uiDescription + "<menuitem action=\"" + tab + "\"/>"
+ uiDescription = uiDescription + "</popup></ui>"
+
++ # Avahi
++ self.avahi_init()
++
+ # Try to connect to MPD:
+ self.mpd_connect(blocking=True)
+ if self.conn:
+@@ -635,7 +648,7 @@
+ self.artwork.update_songinfo(self.songinfo)
+ elif self.initial_run:
+ show_prefs = True
+-
++
+ # Audioscrobbler
+ self.scrobbler_import()
+ self.scrobbler_init()
+@@ -1513,6 +1526,10 @@
+ action_name = self.profile_menu_name(i)
+ actions.append((action_name, None, "[" + str(i+1) + "] " + self.profile_names[i].replace("_", "__"), None, None, i))
+ actions.append(('disconnect', None, _('Disconnect'), None, None, len(self.profile_names)))
++ # avahi connectioms
++ for i in range(len(self.avahi_names)):
++ action_name = self.avahi_menu_name(i)
++ actions.append((action_name, None, '[' + self.avahi_host[i] + '] ' + self.avahi_names[i].replace("_", "__"), None, None, -1 * i - 1))
+ active_radio = self.profile_num
+ if not self.conn:
+ active_radio = len(self.profile_names)
+@@ -1531,6 +1548,10 @@
+ for i in range(len(self.profile_names)):
+ action_name = self.profile_menu_name(len(self.profile_names)-i-1)
+ uiDescription = uiDescription + """<menuitem action=\"""" + action_name + """\" position="top"/>"""
++ uiDescription = uiDescription + """<separator name="FM1" position="top"/>"""
++ for i in range(len(self.avahi_names)):
++ action_name = self.avahi_menu_name(len(self.avahi_names)-i-1)
++ uiDescription = uiDescription + """<menuitem action=\"""" + action_name + """\" position="top"/>"""
+ uiDescription = uiDescription + """</menu></popup></ui>"""
+ self.merge_id = self.UIManager.add_ui_from_string(uiDescription)
+ self.UIManager.insert_action_group(self.actionGroupProfiles, 0)
+@@ -1542,7 +1563,12 @@
+ if current.get_name() == 'disconnect':
+ self.on_disconnectkey_pressed(None)
+ else:
+- self.profile_num = current.get_current_value()
++ if current.get_current_value() < 0:
++ self.profile_num = 0
++ self.avahi_num = -1 * current.get_current_value() - 1
++ else:
++ self.profile_num = current.get_current_value()
++ self.avahi_num = None
+ self.on_connectkey_pressed(None)
+
+ def mpd_connect(self, blocking=False, force=False):
+@@ -1560,9 +1586,14 @@
+ if self.user_connect or force:
+ mpdh.call(self.client, 'disconnect')
+ host, port, password = misc.mpd_env_vars()
+- if not host: host = self.host[self.profile_num]
+- if not port: port = self.port[self.profile_num]
+- if not password: password = self.password[self.profile_num]
++ if self.avahi_num is not None:
++ if not host: host = self.avahi_host[self.avahi_num]
++ if not port: port = self.avahi_port[self.avahi_num]
++ if not password: password = ''
++ else:
++ if not host: host = self.host[self.profile_num]
++ if not port: port = self.port[self.profile_num]
++ if not password: password = self.password[self.profile_num]
+ mpdh.call(self.client, 'connect', host, port)
+ if len(password) > 0:
+ mpdh.call(self.client, 'password', password)
+@@ -1594,8 +1625,14 @@
+ if host or port:
+ self.actionGroupProfiles.list_actions()[0].activate()
+ else:
++ if self.avahi_num is not None:
++ menu_name = self.avahi_menu_name
++ num = self.avahi_num
++ else:
++ menu_name = self.profile_menu_name
++ num = self.profile_num
+ for gtkAction in self.actionGroupProfiles.list_actions():
+- if gtkAction.get_name() == self.profile_menu_name(self.profile_num):
++ if gtkAction.get_name() == menu_name(num):
+ gtkAction.activate()
+ break
+ self.skip_on_profiles_click = False
+@@ -5350,6 +5387,44 @@
+ or (HAVE_EGG and self.trayicon.get_property('visible')))
+ self.preferences.on_prefs_real(self.window, self.popuptimes, audioscrobbler is not None, self.scrobbler_import, self.scrobbler_init, self.scrobbler_auth_changed, trayicon_available, trayicon_in_use, self.on_connectkey_pressed, self.on_currsong_notify, self.update_infofile, self.prefs_notif_toggled, self.prefs_stylized_toggled, self.prefs_art_toggled, self.prefs_playback_toggled, self.prefs_progress_toggled, self.prefs_statusbar_toggled, self.prefs_lyrics_toggled, self.prefs_trayicon_toggled, self.prefs_window_response)
+
++ def avahi_init(self):
++ self.avahi_names = []
++ self.avahi_host = []
++ self.avahi_port = []
++ self.avahi_num = None
++ if HAVE_AVAHI:
++ bus = dbus.SystemBus()
++ self.server = dbus.Interface( bus.get_object(avahi.DBUS_NAME, '/'), 'org.freedesktop.Avahi.Server')
++ sbrowser = dbus.Interface(bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, AVAHI_TYPE, 'local', dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
++ sbrowser.connect_to_signal("ItemNew", self.on_avahi_service_add)
++ sbrowser.connect_to_signal("ItemRemove", self.on_avahi_service_remove)
++ sbrowser.connect_to_signal('Failure', self.on_avahi_service_error)
++
++ def avahi_menu_name(self, num):
++ return _("ZeroConf") + ": " + self.avahi_names[num].replace("&", "")
++
++ def avahi_resolve_service(self, *args):
++ if not args[2] in self.avahi_names:
++ self.avahi_names.append(args[2])
++ self.avahi_host.append(args[5])
++ self.avahi_port.append(args[8])
++ self.populate_profiles_for_menu()
++ return
++
++ def on_avahi_service_error(*args):
++ print 'Error resolving ZeroConf service: ', args[0]
++
++ def on_avahi_service_add(self, interface, protocol, name, stype, domain, flags):
++ self.server.ResolveService(interface, protocol, name, stype, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0), reply_handler=self.avahi_resolve_service, error_handler=self.on_avahi_service_error)
++
++ def on_avahi_service_remove(self, interface, protocol, name, stype, domain, flags):
++ if name in self.avahi_names:
++ index = self.avahi_names.index(name)
++ self.avahi_names.pop(index)
++ self.avahi_host.pop(index)
++ self.avahi_port.pop(index)
++ self.populate_profiles_for_menu()
++
+ def scrobbler_init(self):
+ if audioscrobbler is not None and self.as_enabled and len(self.as_username) > 0 and len(self.as_password_md5) > 0:
+ thread = threading.Thread(target=self.scrobbler_init_thread)
diff --git a/media-sound/sonata/sonata-9999.ebuild b/media-sound/sonata/sonata-9999.ebuild
new file mode 100644
index 0000000..c2d39c9
--- /dev/null
+++ b/media-sound/sonata/sonata-9999.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+EAPI=2
+
+inherit distutils subversion
+
+DESCRIPTION="an elegant GTK+ music client for the Music Player Daemon (MPD)."
+HOMEPAGE="http://sonata.berlios.de/"
+ESVN_REPO_URI="http://svn.berlios.de/svnroot/repos/sonata/trunk"
+
+LICENSE="GPL-3"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~ppc-macos ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+SLOT="0"
+IUSE="taglib lyrics dbus scrobbler"
+
+RDEPEND=">=virtual/python-2.4
+ >=dev-python/pygtk-2.10
+ taglib? ( >=dev-python/tagpy-0.93 )
+ dbus? ( dev-python/dbus-python )
+ lyrics? ( dev-python/zsi )
+ scrobbler? ( dev-python/elementtree )
+ x11-libs/gtk+:2[jpeg]"
+
+DOCS="CHANGELOG README TODO TRANSLATORS"
+
+src_unpack() {
+ subversion_src_unpack
+ cd "${S}"
+
+ epatch "${FILESDIR}/${PN}-zeroconf-support.patch"
+}