emesene forum
March 15, 2010, 07:54:52 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: REPORT ANY ISSUE HERE - PLEASE CHECK IF THE PROBLEM HAS ALREADY BEEN REPORTED FIRST -- THANKS
 
  Home   Forum   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [PATCH] Make CurrentSong-plugin work with Exaile 0.3.x  (Read 1335 times)
runeks
Jr. Member
**

l33tness: 0
Offline Offline

Posts: 6


View Profile Email
« on: September 30, 2009, 03:49:31 PM »

Hello dear emesene developers! Thank you for making this beautiful MSN client for Linux, I've been using this ever since I discovered it.

For the past couple of hours I've been fiddling with getting emesene's CurrentSong-plugin to work with the newest version of the Exaile media player (0.3.x), and it seems like it's working now, so I'm posting the patch here.

(Though, something that I'm just realizing now, is that this breaks support with earlier (0.2.x) versions of Exaile (I blame caveat #3, see below). This should of course be coded into the Exaile class using the getVersion() function - and as far as I can see, it should be relatively easy. But as it's getting late here now I won't be doing this just yet at least Smiley.)

Cheers!

Caveats:
1. As far as I can see, currently there is no way to get the path of the currently playing item's cover art via DBus. So a "" string is just returned (I don't know what else to do; see Caveat #3).
2. If, for example, the album title isn't present in the currently playing item, the resulting status will just be "<title> - <artist> ()" - that is, just an empty string where the album title would have been. To clean this up one would have to test if there actually is an album title present and remove the parentheses if that is the case. As I see it, this would - however - require a change in the CurrentSong class, and I've just been working on the Exaile-part.
3. This is the very first thing I have _ever_ written in Python! I Googled my way to learn the most basic things (and it's 1:30 AM here right now), so it might not be written in the most elegant way possible. But it works Smiley.
Logged
runeks
Jr. Member
**

l33tness: 0
Offline Offline

Posts: 6


View Profile Email
« Reply #1 on: September 30, 2009, 03:51:31 PM »

...and I forgot to attach the patch (of course). Yes, it's getting late Smiley. Here it is.
Logged
runeks
Jr. Member
**

l33tness: 0
Offline Offline

Posts: 6


View Profile Email
« Reply #2 on: September 30, 2009, 06:13:26 PM »

Upon further thought, using the getVersion() DBus function is of course not an option. The way in which we connect to Exaile's DBus functionality has changed between versions, so we can't really connect to its DBus functionality to find out how to connect to its DBus functionality Smiley.

So I think the outcome of this is that the patch from my previous post, should be used to add functionality for the CurrentSong plugin to be able to talk to Exaile 0.3.x, but the user has to select either "Exaile 0.2.x" (which would correspond to using the already-existent "Exaile" DBus functionality) from the list of Music players in the configuration of the CurrentSong plugin or "Exaile 0.3.x" (the Exaile DBus functionality that my patch adds). That way Emesene retains compatibility with both Exaile 0.2.x and 0.3.x, although we require the user to know which version he or she is using.

Phew! That's all for me today, goodnight Smiley.
Logged
C10uD
ololol
Administrator
Hero Member
*****

l33tness: -9988
Offline Offline

Posts: 2145



View Profile Email
« Reply #3 on: October 01, 2009, 05:02:37 AM »

uhm, if you want, i can apply the patch in svn Smiley
Logged
runeks
Jr. Member
**

l33tness: 0
Offline Offline

Posts: 6


View Profile Email
« Reply #4 on: October 01, 2009, 07:25:24 AM »

Hmm. The question is if we should break compatibility with Exaile 0.2.x while on the other hand making it work with Exaile 0.3.x. Exaile 0.3.x is the current working version, 0.2.x isn't developed any more as far as I know. So in that view it would make sense to replace the functionality to something 0.3.x-compatible.
It would, however, be a bummer for someone using Exaile 0.2.x, if we were to break compatibility with this version when we have code to actually make it work. So the question is if we should wait and implement it like I've suggested in the above post, which would require additional coding (something I don't plan on doing just yet, at least not within the following days), or if it should be patched to support Exaile 0.3.x only and not 0.2.x.

I guess I'm leaning more in the direction of implementing the patch, and thus lose 0.2.x compatibility, and then implement a solution where both versions work at a later time.

So I vote yes, I would like the SVN version patched with my patch Smiley.
Logged
C10uD
ololol
Administrator
Hero Member
*****

l33tness: -9988
Offline Offline

Posts: 2145



View Profile Email
« Reply #5 on: October 01, 2009, 07:56:41 AM »

ok, i don't care about old versions since emesene1.5 is designed for modern distros
Logged
C10uD
ololol
Administrator
Hero Member
*****

l33tness: -9988
Offline Offline

Posts: 2145



View Profile Email
« Reply #6 on: October 01, 2009, 10:50:36 AM »

done
Logged
TJUndead
Jr. Member
**

l33tness: 2
Offline Offline

Posts: 6


View Profile
« Reply #7 on: October 01, 2009, 11:38:40 AM »

Man, I have a stupid question... How can I apply this patch?

I'm using ubuntu 9.04, and I use linux for some months, but I never apply a patch on nothing so I dont' know how to do.

Any help, please?

Thanks in advanced.
Logged
the_shade
Jr. Member
**

l33tness: 0
Offline Offline

Posts: 5


View Profile
« Reply #8 on: October 04, 2009, 04:30:02 AM »

download the patch  on the desktop and in a terminal run this

patch /usr/share/emesene/plugins_base/currentSong/Exaile.py ~/Desktop/currentSong-Exaile.diff
restart emesene & enjoy Grin
Logged
gilgamezh
Newbie
*

l33tness: 0
Offline Offline

Posts: 4


View Profile Email
« Reply #9 on: Yesterday at 07:26:46 AM »

When I try to apply the patch, I returned the following error

Code:
gilgamezh@Trantor:~/Temp$ sudo patch /usr/share/emesene/plugins_base/currentSong/Exaile.py currentSong-Exaile.diff  -R
patching file /usr/share/emesene/plugins_base/currentSong/Exaile.py
Hunk #1 succeeded at 16 with fuzz 2.
Hunk #2 FAILED at 37.
1 out of 2 hunks FAILED -- saving rejects to file /usr/share/emesene/plugins_base/currentSong/Exaile.py.rej

i can't patch de file.

i'm using  emesene 1.6.X PPA-r1947 "mate" and Exaile 0.3.1b

This is and contents of the file Exaile.py.rej


Code:
***************
*** 37,76 ****
          
      def getCoverPath( self ):
          if self.iface:
-             return ""
          else:
              return None
      
      def setCurrentSongData( self ):
          if self.iface and self.isNameActive(IFACE_NAME):
-             self.artist = self.iface.GetTrackAttr('artist')
-             self.title = self.iface.GetTrackAttr('title')
-             self.album = self.iface.GetTrackAttr('album')
-             if self.artist == None:
-                 self.artist = ""
-             if self.title == None:
-                 self.title = ""
-             if self.album == None:
-                 self.album = ""
  
      def getVersion( self ):
          try:
-             self.iface.GetVersion()
          except:
              return False
          
          return True
      
      def isPlaying( self ):
- return self.iface.IsPlaying()
          
      def check( self ):
          if not self.iface or not self.isNameActive(IFACE_NAME):
              return
          
-         if self.artist != self.iface.GetTrackAttr('artist') or \
-            self.title != self.iface.GetTrackAttr('title') or \
-            self.album != self.iface.GetTrackAttr('album'):
              self.setCurrentSongData()
              return True
              
--- 37,78 ----
          
      def getCoverPath( self ):
          if self.iface:
+             return self.iface.get_cover_path()
          else:
              return None
      
      def setCurrentSongData( self ):
          if self.iface and self.isNameActive(IFACE_NAME):
+             self.artist = self.iface.get_artist()
+             self.title = self.iface.get_title()
+             self.album = self.iface.get_album()
  
      def getVersion( self ):
          try:
+             self.iface.get_version()
          except:
              return False
          
          return True
      
      def isPlaying( self ):
+         if not self.getVersion():
+             return False
+            
+         if self.iface.get_artist() != None and \
+            self.iface.get_title() != None and \
+            self.iface.get_album() != None:
+             return True
+        
+         return False
          
      def check( self ):
          if not self.iface or not self.isNameActive(IFACE_NAME):
              return
          
+         if self.artist != self.iface.get_artist() or \
+            self.title != self.iface.get_title() or \
+            self.album != self.iface.get_album():
              self.setCurrentSongData()
              return True
              


On another occasion he had applied the patch and it worked OK.
This problem is from the last 2 updates Emesene

Logged
C10uD
ololol
Administrator
Hero Member
*****

l33tness: -9988
Offline Offline

Posts: 2145



View Profile Email
« Reply #10 on: Yesterday at 07:54:38 AM »

this patch should be already in svn
Logged
gilgamezh
Newbie
*

l33tness: 0
Offline Offline

Posts: 4


View Profile Email
« Reply #11 on: Yesterday at 08:51:22 AM »

I will try reinstalling.

I understand that should have the latest version of SVN. I'm using this repositories:

Code:
##emesene

http://ppa.launchpad.net/bjfs/ppa/ubuntu karmic main deb
deb-src karmic main http://ppa.launchpad.net/bjfs/ppa/ubuntu
Logged
gilgamezh
Newbie
*

l33tness: 0
Offline Offline

Posts: 4


View Profile Email
« Reply #12 on: Yesterday at 08:59:03 AM »

uninstall with apt-get remove - purge "

delete the directory / usr / share / emesene

and went to install.

It did not work, I attach the screenshot.
Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v.1.0.6 beta 2 © Bloc
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!