On Wed, Mar 30, 2016 at 9:29 AM, Mehturt <meht...@gmail.com> wrote: >>> I've created last.fm scrobbler using their 2.0 API, since the current >>> one was not working properly. >>> It's a Perl script that parses "xmms2 current" output and acts upon it. >>> I am currently testing it by running it in a loop, like this: >>> >>> while [ true ]; do >>> xmms2 current | ./script.pl >>> sleep 30 >>> done >>> >>> but I thought there would be a better way to get notified by xmms2 >>> e.g. when track changes. >> >> If you want to use perl, there definitely is, since we have perl >> client bindings :). > > Thanks for the pointer, I overlooked the Perl client bindings when > looking at Debian packages, most likely because for Python it's called > python-xmmsclient, for Ruby it's ruby-xmmsclient but for Perl it's > libaudio-xmmsclient-perl, but maybe it's a naming convention. > >> >> I'd start by looking at >> https://git.xmms2.org/xmms2/xmms2-tutorial/tree/perl/tut6.pl. >> After applying the attached patch, it'll print the ID of the current >> song whenever the track changes. >> >> $ perl tut6.pl >> Current id is 47 >> Current id is 499 >> Current id is 650 >> Current id is 900 >> Current id is 733 >> Current id is 783 >> Current id is 108 >> Current id is 894 >> Current id is 717 >> Current id is 395 >> ^C >> >> The code for the perl bindings, to see what is available, is at >> https://git.xmms2.org/xmms2/xmms2-devel/tree/src/clients/lib/perl. >> > > Thanks, I was able to get the async part working with some minor > modifications. > I'm seeing one problem though, when I have my script running, and I > quit xmms2 via "xmms2 quit", I get infinite loop of the following > messages: > > ****** > * xmmsc_io_in_handle was called although the xmms2 daemon is not connected > * This is probably an error in the application using libxmmsclient > ****** > > Any idea why? > Thanks a lot for your support.
And this is what I use at the moment for testing.. https://github.com/mehturt/xmms2_lastfm_scrobbler/blob/master/scrobbler.pl Comments welcome. m. -- _______________________________________________ Xmms2-devel mailing list Xmms2-devel@lists.xmms2.org https://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel