commit:     2f8d66d7600d62428c4b0e762c4732590607b2ef
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 20 20:17:44 2021 +0000
Commit:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Tue Apr 20 20:17:57 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f8d66d7

gnome-extra/gnome-integration-spotify: fix dbus integration

Closes: https://bugs.gentoo.org/782433
Package-Manager: Portage-3.0.17, Repoman-3.0.2
RepoMan-Options: --force
Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 ...-integration-spotify-command-line-parsing.patch | 11 ++++++
 ...ome-integration-spotify-correct-interface.patch | 23 +++++++++++++
 .../files/gnome-integration-spotify-use-glib.patch | 40 ++++++++++++++++++++++
 ...> gnome-integration-spotify-20140907-r2.ebuild} |  8 ++++-
 4 files changed, 81 insertions(+), 1 deletion(-)

diff --git 
a/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-command-line-parsing.patch
 
b/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-command-line-parsing.patch
new file mode 100644
index 00000000000..505a155f32e
--- /dev/null
+++ 
b/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-command-line-parsing.patch
@@ -0,0 +1,11 @@
+--- spotify-dbus.py_orig       2021-04-12 11:11:00.710360694 +0200
++++ spotify-dbus.py    2021-04-12 11:53:06.208197383 +0200
+@@ -632,7 +636,7 @@
+                       self.action_trigger('play')
+               
+               # Play/pause (0.6)
+-              elif '--playpause' or 'playpause' in sys.argv:
++              elif '--playpause' in sys.argv or 'playpause' in sys.argv:
+                       self.action_trigger('playpause')
+               
+               # Stop

diff --git 
a/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-correct-interface.patch
 
b/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-correct-interface.patch
new file mode 100644
index 00000000000..bf59f89077b
--- /dev/null
+++ 
b/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-correct-interface.patch
@@ -0,0 +1,23 @@
+--- spotify-dbus.py_orig       2021-04-12 11:11:00.710360694 +0200
++++ spotify-dbus.py    2021-04-12 11:50:55.946631871 +0200
+@@ -227,8 +227,7 @@
+                       if self.debug == True:
+                               print("Opening " + param + "...")
+       
+-                      window = self.get_window()
+-                      window._openLink(param)
++                      self.player.OpenUri(param)
+       
+       # Action listener
+       def action_listener(self, id = 0, action = ''):
+@@ -322,8 +321,8 @@
+       # Get the player object
+       def get_player(self):
+               try:
+-                      proxyobj = 
self.bus.get_object('org.mpris.MediaPlayer2.spotify', '/')
+-                      pl = dbus.Interface(proxyobj, 
'org.freedesktop.MediaPlayer2')
++                      proxyobj = 
self.bus.get_object('org.mpris.MediaPlayer2.spotify', '/org/mpris/MediaPlayer2')
++                      pl = dbus.Interface(proxyobj, 
'org.mpris.MediaPlayer2.Player')
+               except dbus.DBusException:
+                       pl = False
+       

diff --git 
a/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-use-glib.patch
 
b/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-use-glib.patch
new file mode 100644
index 00000000000..a247aaaeb2a
--- /dev/null
+++ 
b/gnome-extra/gnome-integration-spotify/files/gnome-integration-spotify-use-glib.patch
@@ -0,0 +1,40 @@
+--- spotify-dbus.py_orig       2021-04-12 11:11:00.710360694 +0200
++++ spotify-dbus.py    2021-04-12 11:23:16.895644502 +0200
+@@ -39,7 +39,7 @@
+ import sys
+ import dbus
+ import time
+-from gi.repository import GObject
++from gi.repository import GLib
+ import hashlib
+ import sys
+ if (sys.version_info) < (3, 0):
+@@ -146,8 +146,8 @@
+                                       
interface.connect_to_signal('ActionInvoked', self.action_listener)
+       
+                               
interface.connect_to_signal('NotificationClosed', self.action_dismisser)
+-                              GObject.threads_init()
+-                              GObject.timeout_add(self.timeout * 10, 
self.action_listener)
++                              GLib.threads_init()
++                              GLib.timeout_add(self.timeout * 10, 
self.action_listener)
+       
+               return self.nid
+               
+@@ -532,7 +532,7 @@
+                       self.locale = locale
+               
+               # loop must be global to can quit from listener
+-              self.loop = GObject.MainLoop()
++              self.loop = GLib.MainLoop()
+               
+               # Prepare loop for interactive notifications or daemon mode
+               self.dloop = DBusGMainLoop()
+@@ -606,7 +606,7 @@
+               
+                       # Start loop listening for track changes
+                       try:
+-                              GObject.timeout_add(100, self.change_listener)
++                              GLib.timeout_add(100, self.change_listener)
+                               self.loop.run()
+                       except KeyboardInterrupt:
+                               print('Stopping daemon...')

diff --git 
a/gnome-extra/gnome-integration-spotify/gnome-integration-spotify-20140907-r1.ebuild
 
b/gnome-extra/gnome-integration-spotify/gnome-integration-spotify-20140907-r2.ebuild
similarity index 81%
rename from 
gnome-extra/gnome-integration-spotify/gnome-integration-spotify-20140907-r1.ebuild
rename to 
gnome-extra/gnome-integration-spotify/gnome-integration-spotify-20140907-r2.ebuild
index f574ffecc96..049a2479a33 100644
--- 
a/gnome-extra/gnome-integration-spotify/gnome-integration-spotify-20140907-r1.ebuild
+++ 
b/gnome-extra/gnome-integration-spotify/gnome-integration-spotify-20140907-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -28,6 +28,12 @@ RDEPEND="${DEPEND}
        x11-misc/xdotool
        x11-apps/xwininfo"
 
+PATCHES=(
+       "${FILESDIR}/gnome-integration-spotify-command-line-parsing.patch"
+       "${FILESDIR}/gnome-integration-spotify-correct-interface.patch"
+       "${FILESDIR}/gnome-integration-spotify-use-glib.patch"
+)
+
 src_install() {
        dobin spotify-dbus.py
        python_replicate_script "${ED}"/usr/bin/spotify-dbus.py

Reply via email to