error handling of libxmms
Christoph Wiedemann <[email protected]> Thu, 30 Mar 2006 21:44:25 +0200
| Newsgroups | gmane.comp.multimedia.xmms.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm currently trying to write an remote control interface for xmms using
PyXMMS on a debian sarge system. Everything works quite ok, but
sometimes the communication between the python script and the xmms
session doesn't seem to work. In this case i do not get any error
messages, but some wrong results. E.g. xmms.get_playlist_pos() returns 0
in these rare cases instead of the true value. I thirst suspected the
python wrapper to be incomplete, but then i found that Kara White posted
a problem in April 2004 to that list, that sounded very similar to mine:
Most of the time, the xmms_remote* functions behave correctly, but
sometimes the communications fails, but instead of returning an error
value, the value returned is a wrong one.
Is there anyone out there with a solution for me?
Thank you,
Christoph
PS: i'm running xmms 1.2.10 on a 2.6.13 kernel. PyXMMS version is 2.04.
Kara White wrote on 26 Apr 2004:
<<<
I recently upgraded to the 2.6.4 kernel, and found that my OSD plugin was
displaying information every once in a while when nothing had changed
(displaying the volume when I hadn't changed anything, displaying the song
when the same song had been playing, etc). I upgraded to the newest
versions of both xmms and xmms-osd, but the problem still held.
So, upon inspection of the source, I found that libxmms (used for all
xmms_remote calls) typically returns 0 as a default value if it isn't able
to connect to the user-specified xmms instance. Functions
xmms_remote_get_playlist_pos, xmms_remote_get_main_value, and others are
SUPPOSED to return gint, but all call remote_get_gint which actually returns
guint (unsigned), and returns 0 if it's not able to connect to the session:
gint fd, ret = 0;
if ((fd = xmms_connect_to_session(session)) == -1)
return ret;
Thus, if one was to call xmms_remote_get_playlist_pos, and for some reason
or another, the process wasn't able to connect to the xmms instance, it
would return 0, indicating that the first song in the playlist was being
played. What I suggest is either returning -1 (like the function would have
you assume), or setting errno if remote_get_gint fails at
xmms_connect_to_session. As best as I can tell, this is what's happening on
my computer. For some reason or another, through crappy new kernel code,
every once in a while the socket connection to /tmp/xmms_user.0 fails, I get
0 as the playlist position (or volume), it displays this to the screen, and
on the very next call it does connect, I get the proper readings, and it
displays the new _real_ information.
So if anyone has any suggestions for the kernel issue, or the developers
agree that there should be some sort of error handling in libxmms, drop me a
line so I can get this straightened out.
<<<