Hi,
well, the whole reason I need the length is for a small last.fm scrobble
script that uses lastfmsubmitd to do the actual scrobbling. It requires
the song length which is all that I am missing. Here's the script so
far, it's only a rough draft:
#!/bin/bash
file=$(echo "$info" | sed -n 's/^file //p')
artist=$(echo "$info" | sed -n 's/^tag artist //p')
album=$(echo "$info" | sed -n 's/^tag album //p')
title=$(echo "$info" | sed -n 's/^tag title //p')
if [ -n "$artist" -a -n "$album" ] ; then
if [ -n "$title" -a -n "$length" ] ; then
/usr/lib/lastfmsubmitd/lastfmsubmit --artist "$artist" --title "$title"
--album "$album" --length "$length"
fi
fi
exit 0
Thanks
Storm
--
Vinux Publicity Coordinator: http://www.vinuxproject.org/
Registered Linux user number 508465: http://counter.li.org/
My blog, Thoughts of a Dragon: http://www.stormdragon.us/
How many Internet mail list subscribers does it take to change a lightbulb? http://goo.gl/eO4PJ
"gimme gimme shock treatment! I wanna wanna shock treatment!"
Ramones
Post by Jason WoofendenPost by Storm DragonHi,
length=$(echo "$info" | sed -n 's/^duration //p')
No, status_display_program is a setting in cmus. You tell it what
program (shell script) you want run when the play state changes (eg
when a new track starts playing.)
When cmus knows the duration, it tells that program via a
command-line argument.
The command-line arguments alternate between keys and values, so
you've gotta look through for one that's "duration" and the
following argument will be the duration of the track.
Check out the example program cmus-status-display that comes with
cmus. It does this cool trick to turn those arguments into
while test $# -ge 2
do
eval _$1='$2'
shift
shift
done
Then you'll have $_duration with the length of the track in
seconds. (Unless cmus doesn't tell you the duration, as I would
expect from a streaming radio station or something.)
So if you want to be able to quickly grab the duration from other
if -n "$_duration"
then
echo -n "$_duration" > "$HOME/tmp/cmus_cur_duration.txt"
fi
duration="$(cat "$HOME/tmp/cmus_cur_duration.txt")"
-- Jason
------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/