Skip to content

Commit

Permalink
rpc: added ability to favorize tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
trapd00r committed Jun 20, 2010
1 parent 5b76d81 commit 317d89e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions rpc
Expand Up @@ -25,12 +25,13 @@ use Mplayer::NowPlaying qw(stream_np $np_log);
use Data::Dumper;

my $options;
my $action = shift;
my $arg = shift;
my $pipe_w = "$ENV{HOME}/.mplayer/rpd.fifo";
my $log = "$ENV{HOME}/.mplayer/rpd.log";
$np_log = $log;
my $rpd_pid = '/tmp/rpd.pid';
my $action = shift;
my $arg = shift;
my $pipe_w = "$ENV{HOME}/.mplayer/rpd.fifo";
my $log = "$ENV{HOME}/.mplayer/rpd.log";
my $favtracks = "$ENV{HOME}/.mplayer/rpd.fav";
$np_log = $log;
my $rpd_pid = '/tmp/rpd.pid';

if(!-f $rpd_pid) {
print "RPD is not running, starting...\n";
Expand Down Expand Up @@ -106,6 +107,12 @@ $options = {
sleep 3;
$options->{np}->();
},
fav => sub {
my $info = stream_np();
open(my $fh, '>>', $favtracks) or die "Cant append data to $favtracks: $!";
print $fh $info->{title}, "\n";
close($fh);
},
};


Expand All @@ -130,6 +137,7 @@ sub usage {
npi show the currently playing song on one line
play play/switch to channel
list list all available channels
fav add track to the favlist
son turn on sound
soff turn off sound
toggle toggle playback status, pause/play
Expand Down

0 comments on commit 317d89e

Please sign in to comment.