Re: Re: Send played status to a different program?

Roy Schestowitz <[email protected]> Fri, 05 May 2006 16:58:48 +0100
Newsgroups gmane.comp.multimedia.xmms.devel
Message-ID <[email protected]>
___/ On Thu 04 May 2006 18:36:58 BST, [ Steinar Bang ] wrote : \___

>>>>>> "Morgan Reed" <[email protected]>:
>
>> Probably fairly simple to write a plugin to do this.
>
>> What do you want it for? (I assume some kind of "favourites list" or
>> something like AudioScrobbler??)
>
> I was thinking of doing something similar to what iTunes does (or can
> do) with podcasts: delete the ones that have been played.
>
> I'm currently using nnrss in Gnus to download the podcasts, and I was
> thinking about extending that functionality.

___/ On Thu 04 May 2006 18:43:35 BST, [ Steinar Bang ] added : \___

>>>>>> Dirk Jagdmann <[email protected]>:
>
>> Try the "Song Change" Plugin, which you'll find in the "General" Tab
>> in the preferences.
>
> Thanx for the tip!  If I understand it correctly, it means that I can
> call a command when xmms starts and comes to the end of a song, giving
> eg. the name of the file as an argument?
>
> Calling the command at the end of a file will be sufficient for my
> purposes, I think, because I wish to register that a downloaded
> podcast has been played to the end, so that I can delete it.

I have something very similar to what you seek. You will just need to modify
it very slightly. Here it goes.

As before, specify the following command in the "Song Change" Plugin, under
"Song Change" at the top:

(date +''%R' '%D; echo -n %s) > ~/tmp/track.txt

Now, put the following Perl script somewhere:

#!/usr/bin/perl -w

open(IFP,"/tmp/track.txt") or die
     "could not open file: $!";
$line=<IFP>; # don't need the date
$line=<IFP>;
(undef,undef,$file)=split(/,/, ,$line);
unlink $file or die "could not unlink \"$file\": $!";
close(IFP);

The file /tmp/track.txt will contain the filename and path of the track you
currently listen to. I personally chose to invoke this Perl script to
physically erase songs by pressing SHIFT+CTRL+ALT+Q (globally). You could
set things up so that Song Change or another triggered hook calls the Perl
script. Handle with care and test before using. *smile*

Hope it helps,

Roy