Re: Talk to us first before you start reversing our protocol
Hi! niahoo osef wrote: [...] > With a friend, we are trying to implement the protocol of sending commands to > xmms2 via TCP in Elixir (or Erlang). We feel it's hard to find the appropriate > documentation but I eventually managed to gather some information on the wiki, > hence the title of this email. When I was implementing a client library in Scheme¹, I was faced with a similar problem. I have been making a couple of notes² along the way that may be helpful. > At the moment, we are able to send a hello command to the server. We figured > how to do this by looking at the code of a javascript client. > > I would like to know where is the more fiable source that says that a "hello" > command is "32", that an error type is "1", integer is "2" and must be 64bits, > how to properly encode payload and what to expect in return, … Most of the server's API is actually documented in a machine readable file³, which you should use to generate most of your library. This is true for constants (like what command id is correct for HELLO?) as well. There are only a couple of constants I couldn't find in that spec, and those are the identifiers for the protocol's types. > I don't mind reading any code but I'm far from good at C. I can't find the > python source code for a module named "xmmsapi" that xmmsclient depends on. If Scheme makes you happier, feel free to take a look at what I got⁴. I think the first ability you need is to read data from the server. For that you need to be able to parse a message's header. Then you need serialisation and deserialisation of the protocol's data types to deal with building and reading payload to and from the server. And after that you can generate the actual API from ipc.xml. Regards, Frank ¹ https://github.com/ft/xmms2-guile ² https://github.com/ft/xmms2-guile/blob/master/doc/xmms2-protocol.mdwn If you clone the repository and have pandoc installed, this renders into a PDF as well — I don't know if github's Markdown rendering understands all the markup. ³ https://github.com/xmms2/xmms2-devel/blob/master/src/ipc.xml ⁴ https://github.com/ft/xmms2-guile/tree/master/tests -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925 -- ___ Xmms2-devel mailing list Xmms2-devel@lists.xmms2.org https://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel
Re: xmms2 last.fm scrobbler
Hey Mehturt, thanks for working on this! I tried it out and it seems to work fine with MP3 files. However, when I put playback onto an ogg-vorbis file, I get a slew of warnings and the file is not actually scrobbled at last.fm: 15:53:39 INFO in core: ../src/xmms/xform.c:1335: Successfully setup chain for 'file:///home/hawk/audio/music/Fear+Factory/Obsolete/05+-+Descent.ogg' (4232) containing gvfs:magic:vorbis:segment Use of uninitialized value in division (/) at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 188. Use of uninitialized value $artist in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 191. Use of uninitialized value $title in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 191. Use of uninitialized value $album in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 191. Use of uninitialized value $album in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 29. Use of uninitialized value $artist in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 31. Use of uninitialized value $track in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 34. Use of uninitialized value $artist in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 53. Use of uninitialized value $track in concatenation (.) or string at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 53. Use of uninitialized value $title in string ne at /home/hawk/.config/xmms2/startup.d/scrobbler.pl line 205. Note, that line numbers might be off by one or two, since I am using a "use lib ..." line on top of the scrobbler.pl file, so that I don't have to install the module, but can just use the whole thing from its git repository. Regards, Frank -- ___ Xmms2-devel mailing list Xmms2-devel@lists.xmms2.org https://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel
[PATCH 1/2] Set `CURLOPT_NOSIGNAL' to 1 to avoid crashes with multithreaded DNS
This fixes http://bugs.xmms2.org/view.php?id=2546 Erik Massop noted: In unix systems, CURLOPT_NOSIGNAL need to be used if you're using the default resolver, as it will use signals to time-out otherwise and signals and threads don't mix. But ideally, you switch to using the c-ares resolver then to get proper timeouts even without signals. ...which he quoted from: http://sourceforge.net/tracker/index.php?func=detailaid=2781096group_id=976atid=100976 Signed-off-by: Frank Terbeck f...@bewatermyfriend.org --- src/xmms2-scrobbler.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xmms2-scrobbler.c b/src/xmms2-scrobbler.c index 244fccb..a19eca2 100644 --- a/src/xmms2-scrobbler.c +++ b/src/xmms2-scrobbler.c @@ -317,6 +317,7 @@ do_handshake (Server *server) set_proxy (server, curl); + curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_URL, post_data); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, handle_handshake_reponse); @@ -400,6 +401,7 @@ curl_thread (void *arg) set_proxy (server, curl); + curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_POST, 1); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, handle_submission_reponse); -- 1.8.2.rc1 -- ___ Xmms2-devel mailing list Xmms2-devel@lists.xmms2.org http://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel
[PATCH 2/2] Include stdio.h and add two helper macros
Since 22d52344e1745068e2bc7dd716bf9ec5dc7b8a06 in xmms2, you need to include stdlib.h and stdio.h yourself. Also, the macros XPOINTER_TO_INT() and XINT_TO_POINTER() are now in a private header rather than the public one that gets installed to the system. That makes it a little hard to use said macros. To solve the issue, I'm just defining the macros as they are in the private header. Signed-off-by: Frank Terbeck f...@bewatermyfriend.org --- src/submission.c | 1 + src/xmms2-scrobbler.c | 8 2 files changed, 9 insertions(+) diff --git a/src/submission.c b/src/submission.c index 422db0a..326b003 100644 --- a/src/submission.c +++ b/src/submission.c @@ -22,6 +22,7 @@ */ #include stdlib.h +#include stdio.h #include submission.h Submission * diff --git a/src/xmms2-scrobbler.c b/src/xmms2-scrobbler.c index a19eca2..ec3f1e4 100644 --- a/src/xmms2-scrobbler.c +++ b/src/xmms2-scrobbler.c @@ -48,6 +48,14 @@ #define INVALID_MEDIA_ID -1 +#if defined(__x86_64__) +# define XPOINTER_TO_INT(p) ((int) (long) (p)) +# define XINT_TO_POINTER(i) ((void *) (long) (i)) +#else +# define XPOINTER_TO_INT(p) ((int) (p)) +# define XINT_TO_POINTER(i) ((void *) (i)) +#endif + typedef struct { char name[NAME_MAX + 1]; int hard_failure_count; -- 1.8.2.rc1 -- ___ Xmms2-devel mailing list Xmms2-devel@lists.xmms2.org http://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel