[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Output the filename of the current playing song
From: |
Eric Wong |
Subject: |
Re: Output the filename of the current playing song |
Date: |
Fri, 27 Nov 2015 11:34:08 +0000 |
Rene Maurer <address@hidden> wrote:
> Hello
>
> I am really very happy using dtas. There are some minor things I miss.
> One thing is a shortcut to get the filename of the current playing song.
> For example something like this:
>
> # COMMANDS
>
> * current song [FILENAME] - output the filename of the current playing
> song or the song at the top if the queue in case the player is
> paused. If FILENAME is specified, the output is written to that file.
Great to know you're still using it!
You can use "dtas-ctl current" and parse the YAML output.
Perhaps something along the lines of:
#!/usr/bin/env ruby
require 'yaml'
x = YAML.load `dtas-ctl current`
if cur = x['current']
puts cur['infile']
elsif x['paused']
x = YAML.load `dtas-ctl queue cat`
puts Array(x[0])[0]
end
Fwiw, I never intended the current player protocol to be used
much; but was planning on writing an MPRIS proxy to talk to
dtas-player and encourage users to use existing MPRIS clients
instead...
However, MPRIS seems to be a dead-end for text-only clients;
while mpd has a strong following. So I'll probably start work
on an mpd protocol proxy over holidays, so we'll have a lot more
clients able to use the playback features dtas-player.
Of course, the editing/effects features of dtas will only be
available via the dtas-player protocol, but the MPD-compatible
library will be able to play YAML files intended for
dtas-splitfx (or anything dtas-player understands).