Re: [Gajim-devel] Update status with rhythmbox info

2006-08-24 Thread Le Boulanger Yann
Joel Dimbernat wrote:

> 
> Does Gajim works with galago?
> 
> Maybe it could be one way to deal with it? Galago could have such the
> API you describe and then music players and IM could interact through it...
> 
> 


No, we only use libnotify from their project, but not galago itself.

-- 
Yann
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-23 Thread Joel Dimbernat
2006/8/23, Jan Claeys <[EMAIL PROTECTED]>:
Op ma, 21-08-2006 te 21:32 +0200, schreef Joel Dimbernat:> I see that Quod Libet support the JEP by creating an XML file. But> then how should this file be used by an IM program?> Maybe using Inotify to look for change into it and then publish the
> new status?I think so.> Or do you think gajim should handle it connecting (for example)> rhythmbox dbus (as I did it), but using that JEP xml schema to publish> the info?It would be better if there was some sort of an API that both jabber
clients and music players can implement their side of (maybe in aplugin), and then every jabber client would work with every musicplayer...  :)(JEP-118 could be part of such an API)--Jan Claeys
___Gajim-devel mailing listGajim-devel@gajim.orghttps://lists.gajim.org/cgi-bin/listinfo/gajim-devel
Does Gajim works with galago?Maybe it could be one way to deal with it? Galago could have such the API you describe and then music players and IM could interact through it...
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-23 Thread Jan Claeys
Op ma, 21-08-2006 te 21:32 +0200, schreef Joel Dimbernat:
> I see that Quod Libet support the JEP by creating an XML file. But
> then how should this file be used by an IM program?
> Maybe using Inotify to look for change into it and then publish the
> new status?

I think so.

> Or do you think gajim should handle it connecting (for example)
> rhythmbox dbus (as I did it), but using that JEP xml schema to publish
> the info? 

It would be better if there was some sort of an API that both jabber
clients and music players can implement their side of (maybe in a
plugin), and then every jabber client would work with every music
player...  :)

(JEP-118 could be part of such an API)

-- 
Jan Claeys

___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-21 Thread Joel Dimbernat
2006/8/21, Jan Claeys <[EMAIL PROTECTED]>:
Op zo, 20-08-2006 te 12:59 +0200, schreef Joel Dimbernat:> 2006/8/20, Le Boulanger Yann <[EMAIL PROTECTED]>:> What you'd like is that gajim knows every dbus interface of
> every player nd handle them ? I don't think it's a good idea.> there are too many, and what if a player changes his API ?> I understand you right, but on the other hand should every music
> player implement every dbus interface of every IM program and handle> them?You might want to have a look at JEP-118:This is how Quod Libet supports this (through a plugin):--Jan Claeys___Gajim-devel mailing listGajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-develThanks Jan!I see that Quod Libet support the JEP by creating an XML file. But then how should this file be used by an IM program?
Maybe using Inotify to look for change into it and then publish the new status?Or do you think gajim should handle it connecting (for example) rhythmbox dbus (as I did it), but using that JEP xml schema to publish the info?
Joel
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-21 Thread Jan Claeys
Op zo, 20-08-2006 te 12:59 +0200, schreef Joel Dimbernat:
> 2006/8/20, Le Boulanger Yann <[EMAIL PROTECTED]>:
> What you'd like is that gajim knows every dbus interface of
> every player nd handle them ? I don't think it's a good idea.
> there are too many, and what if a player changes his API ?

> I understand you right, but on the other hand should every music
> player implement every dbus interface of every IM program and handle
> them?

You might want to have a look at JEP-118:


This is how Quod Libet supports this (through a plugin):



-- 
Jan Claeys

___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-20 Thread Joel Dimbernat
2006/8/20, Le Boulanger Yann <[EMAIL PROTECTED]>:
Joel Dimbernat wrote:> 2006/8/20, Le Boulanger Yann <[EMAIL PROTECTED]> [EMAIL PROTECTED]>>:>
> Joel Dimbernat wrote:> > Hello,> >> > I'd like to write something that does the same that gtalk does (i.e> > update status with the played song) for gajim and rhythmbox.
> >> > Gajim has a class that do that very well, named gajim-remote, I've> seen> > some examples. But all these examples were plugins for the music> player,
> > and I don't think (in my very humble opinion) it's the right way> to do it.> >> > Rhythmbox has it's own Dbus API, and I think Gajim should connect> to it
> > and recieve events from it.> >> > So i'm asking you if I'm right or wrong about it?> >> > And is Gajim using other Dbus connection from another program (to have
> > some example)?> >> > Thanks> >>> What you'd like is that gajim knows every dbus interface of every player> nd handle them ? I don't think it's a good idea. there are too many, and
> what if a player changes his API ?>> --> Yann>>> I understand you right, but on the other hand should every music player> implement every dbus interface of every IM program and handle them?
> Gtalk choosed to handle 3 or 4 music players...>> Maybe you're right and I should implement it as a rhythmbox plugin, but> I really think it has its place in Gajim especially to make it take
> place in the GUI.>> I worked a bit on it yesterday and it works not so bad but lacks a bit> of polish yet, I'll post it as soon as it's ok, then you'll be free to> do whatever you want with it.
>> I was impressed by how clear and how easy it was to hack the code,> thanks for it guys!thanks for sending it here, we'll add it to trac for the moment.--Yann
So, here it is...The image is supposed to go in data/pixmaps.I hope it will work for you. Just change the status to "show listened track" when listening to Rhythmbox.The only problem I have and dunno how to solve is that it launches rhythmbox if it's not running when you choose to display the listened track... Dbus is still a lot of mysteries to me.
Joel
Index: src/roster_window.py
===
--- src/roster_window.py	(révision 6658)
+++ src/roster_window.py	(copie de travail)
@@ -18,6 +18,9 @@
 import gobject
 import os
 import time
+import dbus
+import dbus.glib
+import gobject
 
 import common.sleepy
 import history_window
@@ -2223,7 +2226,7 @@
 	def get_status_message(self, show):
 		if (show == 'online' and not gajim.config.get('ask_online_status')) or \
 			(show == 'offline' and not gajim.config.get('ask_offline_status')) or \
-			show == 'invisible':
+			show == 'invisible' or show == 'song':
 			return ''
 		dlg = dialogs.ChangeStatusMessageDialog(show)
 		message = dlg.run()
@@ -2252,11 +2255,13 @@
 on_response_ok = (change, account, status))
 		else:
 			change(None, account, status)
+		
 
 	def on_status_combobox_changed(self, widget):
 		'''When we change our status via the combobox'''
 		model = self.status_combobox.get_model()
 		active = self.status_combobox.get_active()
+
 		if active == -1: # no active item
 			return
 		if not self.combobox_callback_active:
@@ -2269,7 +2274,6 @@
 			self.update_status_combobox()
 			return
 		status = model[active][2].decode('utf-8')
-
 		if active == 7: # We choose change status message (7 is that)
 			# do not change show, just show change status dialog
 			status = model[self.previous_status_combobox_active][2].decode('utf-8')
@@ -2309,7 +2313,39 @@
 if dialog.get_response() != gtk.RESPONSE_OK:
 	self.update_status_combobox()
 	return
+		
+		
 		message = self.get_status_message(status)
+
+		#Establish a connection through dbus with rhythmbox and change
+		#the status with the title and the artist of the listened song.
+		if status == 'song':
+			bus = dbus.SessionBus()
+			rbshellobj = bus.get_object('org.gnome.Rhythmbox', '/org/gnome/Rhythmbox/Shell')
+			rbshell = dbus.Interface(rbshellobj, 'org.gnome.Rhythmbox.Shell')
+			rbplayerobj = bus.get_object('org.gnome.Rhythmbox', '/org/gnome/Rhythmbox/Player')
+			rbplayer = dbus.Interface(rbplayerobj, 'org.gnome.Rhythmbox.Player')
+
+			
+			def playing_uri_changed(uri):
+props = rbshell.getSongProperties(uri)
+	   			for prop in props:
+	if prop == 'title':
+		title = props[prop]
+	if prop == 'artist':
+		artist = props[prop]
+	
+for acct in accounts:
+	current_show = gajim.SHOW_LIST[gajim.connections[acct].connected]
+	self.send_status(acct, current_show, title + " by " + artist)
+			
+			#Connecting to the "On song changed" signal
+			try:	
+rbplayer.connect_to_signal('playingUriChanged', playing_uri_changed)
+			except Exception, e:
+print "Rhythmbox not running"
+
+
 		if message is None: # user pressed Cancel to change status message dialog
 			self.update_status_combobox()
 			r

Re: [Gajim-devel] Update status with rhythmbox info

2006-08-20 Thread Le Boulanger Yann
Joel Dimbernat wrote:
> 2006/8/20, Le Boulanger Yann <[EMAIL PROTECTED]
> >:
> 
> Joel Dimbernat wrote:
> > Hello,
> >
> > I'd like to write something that does the same that gtalk does (i.e
> > update status with the played song) for gajim and rhythmbox.
> >
> > Gajim has a class that do that very well, named gajim-remote, I've
> seen
> > some examples. But all these examples were plugins for the music
> player,
> > and I don't think (in my very humble opinion) it's the right way
> to do it.
> >
> > Rhythmbox has it's own Dbus API, and I think Gajim should connect
> to it
> > and recieve events from it.
> >
> > So i'm asking you if I'm right or wrong about it?
> >
> > And is Gajim using other Dbus connection from another program (to have
> > some example)?
> >
> > Thanks
> >
> 
> What you'd like is that gajim knows every dbus interface of every player
> nd handle them ? I don't think it's a good idea. there are too many, and
> what if a player changes his API ?
> 
> --
> Yann
> 
> 
> I understand you right, but on the other hand should every music player
> implement every dbus interface of every IM program and handle them?
> Gtalk choosed to handle 3 or 4 music players...
> 
> Maybe you're right and I should implement it as a rhythmbox plugin, but
> I really think it has its place in Gajim especially to make it take
> place in the GUI.
> 
> I worked a bit on it yesterday and it works not so bad but lacks a bit
> of polish yet, I'll post it as soon as it's ok, then you'll be free to
> do whatever you want with it.
> 
> I was impressed by how clear and how easy it was to hack the code,
> thanks for it guys!

thanks for sending it here, we'll add it to trac for the moment.

-- 
Yann
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-20 Thread Joel Dimbernat
2006/8/20, Le Boulanger Yann <[EMAIL PROTECTED]>:
Joel Dimbernat wrote:> Hello,>> I'd like to write something that does the same that gtalk does (i.e> update status with the played song) for gajim and rhythmbox.>> Gajim has a class that do that very well, named gajim-remote, I've seen
> some examples. But all these examples were plugins for the music player,> and I don't think (in my very humble opinion) it's the right way to do it.>> Rhythmbox has it's own Dbus API, and I think Gajim should connect to it
> and recieve events from it.>> So i'm asking you if I'm right or wrong about it?>> And is Gajim using other Dbus connection from another program (to have> some example)?>
> Thanks>What you'd like is that gajim knows every dbus interface of every playernd handle them ? I don't think it's a good idea. there are too many, andwhat if a player changes his API ?
--YannI understand you right, but on the other hand should every music player implement every dbus interface of every IM program and handle them?Gtalk choosed to handle 3 or 4 music players...
Maybe you're right and I should implement it as a rhythmbox plugin, but I really think it has its place in Gajim especially to make it take place in the GUI.I worked a bit on it yesterday and it works not so bad but lacks a bit of polish yet, I'll post it as soon as it's ok, then you'll be free to do whatever you want with it.
I was impressed by how clear and how easy it was to hack the code, thanks for it guys!
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] Update status with rhythmbox info

2006-08-20 Thread Le Boulanger Yann
Joel Dimbernat wrote:
> Hello,
> 
> I'd like to write something that does the same that gtalk does (i.e
> update status with the played song) for gajim and rhythmbox.
> 
> Gajim has a class that do that very well, named gajim-remote, I've seen
> some examples. But all these examples were plugins for the music player,
> and I don't think (in my very humble opinion) it's the right way to do it.
> 
> Rhythmbox has it's own Dbus API, and I think Gajim should connect to it
> and recieve events from it.
> 
> So i'm asking you if I'm right or wrong about it?
> 
> And is Gajim using other Dbus connection from another program (to have
> some example)?
> 
> Thanks
> 

What you'd like is that gajim knows every dbus interface of every player
nd handle them ? I don't think it's a good idea. there are too many, and
what if a player changes his API ?

-- 
Yann
___
Gajim-devel mailing list
Gajim-devel@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel