Hi,
I have modified the script somewhat to add the last.fm url, shortened
with is.gd, and to also turn album, artist, and/or title in to hashtags
if they are one word. So, for example, DragonForce becomes #DragonForce.
I have pasted it below in case you would like to add it to the wiki. I
read a suggestion to use --data-urlencode with curl to make sure
everything was encoded correctly but couldn't get it to work.
I am also having a slight problem, it seems like I had it once before,
but I can't remember how to fix it. I have softvolume set to true. Even
at 100% it is still very quiet. Is there a way to raise the volume even
more?
Here's the script:
#!/bin/bash
if ! cmus-remote -C >/dev/null 2>&1 ; then
echo >&2 "cmus is not running"
exit 1
fi
info=$(cmus-remote -Q)
state=$(echo "$info" | sed -n 's/^status //p')
if [ "$state" = "stopped" ] ; then
echo >&2 "no song playing currently, aborting!"
exit 1
fi
file=$(echo "$info" | sed -n 's/^file //p')
artist=$(echo "$info" | sed -n 's/^tag artist //p')
if [[ $(echo "$artist" | sed 's/ /./g') == "$artist" && -n
"$artist" ]] ; then
artist="#$artist"
fi
album=$(echo "$info" | sed -n 's/^tag album //p')
if [[ $(echo "$album" | sed 's/ /./g') == "$album" && -n
"$album" ]] ; then
album="#$album"
fi
title=$(echo "$info" | sed -n 's/^tag title //p')
if [[ $(echo "$title" | sed 's/ /./g') == "$title" && -n
"$title" ]] ; then
title="#$title"
fi
if [ -z "$title" ] ; then
title=$(basename "$file" | sed 's/\.[A-Za-z0-9]*$//')
fi
if [ -n "$title" -a -n "$artist" -a -n "$album" ] ; then
msg="$title by $artist from $album"
longUrl="http://www.last.fm/search?q=${artist}%2B${title}"
else
msg="$title"
longUrl="http://www.last.fm/search?q=$(echo "$title" | tr -d "-"
| tr -s " " | sed 's/ /%2B/g')"
fi
shortUrl=$(curl http://is.gd/api.php?longurl=$longUrl)
if [[ ${#msg[*]} -lt "121" ]] ; then
msg="$msg $shortUrl"
fi
ttytter -norc -silent -readline=0 -status="#nowplaying $msg."
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
Get yourself a Frostbox http://www.frostbitesystems.com/
"It's not our aim to hum, to aspirate, to perish tardily. It's our goal to be, and to become, and to rise constantly."
Van Canto
Post by Johannes WeiÃlHi,
Post by Storm DragonI am revisiting this topic after a couple of months because I can't
figure out how to do something that is probably actually pretty easy. I
http://www.floodgap.com/software/ttytter
and would like to bind a key to post the currently playing song to
http://cmus.sourceforge.net/wiki/doku.php?id=shell_scripts
but it didn't seem to be what I need. Basically, when I press shift+T
ttytter -status="#nowplaying $title by $artest from $album."
http://cmus.sourceforge.net/wiki/doku.php?id=cmus_ttytter
Is it working for you?
Post by Storm DragonI usually add the last.fm link for the search of the song, but I think
if someone gets me started with the script I should be able to add that
part.
lastfm_link=$(python -c "from urllib import quote_plus
print 'http://www.last.fm/music/'+quote_plus('$artist')+'/_/'+quote_plus('$title')")
Post by Storm DragonAlso, because not all of my music has information incoded, it would be
cool to be able to use the song name minus the extension if the artist,
title, and album information are blank.
Already included!
Greetings,
Johannes
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev