You are not logged in.
Pages: 1
I just moved to MPD from Rhythmbox because I am building a PC remote using a web interface for my phone. MPD is great and I love the whole Client/Server thing but a few things are bugging me and I was just wondering if anyone could shed any light.
First of all (and mainly) Rhythmbox notifies me when it changes track and the program isn't on the screen (minimised or I'm on another workspace). Is it possible for MPD to do this and/or how would I go about writing my own? I am familiar with notify-send and if I'm not mistaken that's what Rhythmbox calls whenever it changes track. How would I get MPD to do this (MPD, not a client because when the client goes away I want it to keep on telling me the song).
Also, I like having all my music just dumped onto the screen so that I can keep it on shuffle and/or live search through it so that it only plays (randomly) what I searched for. Does mpd support this or is it strictly playlist based? Speaking of which, could someone explain to me the general work flow of an mpd client? Is it double click to add to play queue or a playlist? My method of building a playlist of all my songs and putting it on shuffle just seems backwards.
Thanks
Solution: Not quite ideal but Ario uses notification system so I just keep it in my system tray. Just as good as Rhythmbox was.
Last edited by BaconPie (2010-11-05 11:43:49)
Offline
A quick search in AUR turned up mpd-libnotify. I believe mpd only works via playlists, but I could be wrong... As for clients, check out mpd wiki, personally I like Sonata but their are even clients for cellphones and web-interfaces.
edit: just skimmed the mpd wiki link - tons of stuff. another notify plugin: http://chadok.info/mpn/
"Workflow" differs from client to client I guess, in Sonata double-click/enter adds the selected songs/folders to the playlist (there are shortcuts, e.g. adding ctrl+d, replacing ctrl+r, for start playing if stopped add shift) .
Last edited by hokasch (2010-11-04 17:28:44)
Offline
I didn't think to check the AUR after both the links in that thread where dead.
I installed in anyway, how is it used? No notifications so far (after restating mpd).
Offline
Offline
*facepalm* Ha, thanks.
Offline
Right, I've installed it from the aur here. And when I run it for the first time it creates this config file:
#!/bin/bash
#
# mpdnotify config - any valid bash is allowed, you
# only need to define handle_event() for the deamon
# to run properly
#
# $mydir exists, and it's value is /home/tom/.config/mpdnotify
#
###
###
#
# the actual handle_event() definition
#
# this is the only requirement for a valid config
#
###
fetch_cover () {
album=Beautiful Freak
# do we have a valid album name
file="/"
# Does the covers directory exist? Make it if it does not.
if [ ! -d "" ]; then mkdir -p ""; fi
# have we not fetched this already
if [ ! -f "" ] ; then
echo -n " is not in covers... "
echo ""
url="http://www.albumart.org/index.php?srchkey=&itempage=1&newsearch=1&searchindex=Music"
cover_url=
# is it available
if [ -n "" ]; then
echo retrieved
wget -q -O "" ""
else
echo NOT available
fi
fi
}
handle_event() {
coverDir="/home/tom/.covers/"
tmpCover="/tmp/cover"
baseCover="/usr/share/mpd-libnotify/base.png"
topCover="/usr/share/mpd-libnotify/top.png"
noCover="/usr/share/mpd-libnotify/NOCOVER.png"
mpdPID=17253
mpcArtist="Could not find Artist's name"
mpcTitle="Could not find Song's title"
mpcAlbum="Could not find Album's name"
mpcLength="Could not find Song's length"
if [[ -z ]]; then
echo "MPD is not currently running!"
exit
else
mpcAlbum=Beautiful Freak
mpcArtist=Eels
mpcTitle=Not Ready Yet
mpcLength=4:47
if [ -f "" ]; then rm ""; fi
if [ -f "/" ]; then
cp "/" ""
mogrify -resize 65x65!
convert "" -geometry +4+3 -composite -geometry +0+0 -composite ""
[[ "0" -gt "25" ]] && mpcArtist=...
[[ "0" -gt "25" ]] && mpcTitle=...
[[ "0" -gt "25" ]] && mpcAlbum=...
notify-send --expire-time=1300 -i "" "MPD Notification" "<u></u>
By: <i></i>
From: <i></i>
Length: <i></i>"
else
fetch_cover
if [ -f "/" ]; then
cp "/" ""
mogrify -resize 65x65!
convert "" -geometry +4+3 -composite -geometry +0+0 -composite ""
[[ "0" -gt "25" ]] && mpcArtist=...
[[ "0" -gt "25" ]] && mpcTitle=...
[[ "0" -gt "25" ]] && mpcAlbum=...
notify-send --expire-time=1300 -i "" "MPD Notification" "<u></u>
By: <i></i>
From: <i></i>
Length: <i></i>"
else
cp "" ""
mogrify -resize 65x65!
convert "" -geometry +4+3 -composite -geometry +0+0 -composite ""
[[ "0" -gt "25" ]] && mpcArtist=...
[[ "0" -gt "25" ]] && mpcTitle=...
[[ "0" -gt "25" ]] && mpcAlbum=...
notify-send --expire-time=1300 -i "" "MPD Notification" "<u></u>
By: <i></i>
From: <i></i>
Length: <i></i>"
fi
fi
fi
}The next time I run it it gives me this error:
$ mpdnotify
/home/tom/.config/mpdnotify/config: line 53: unexpected argument `]]' to conditional unary operator
/home/tom/.config/mpdnotify/config: line 53: syntax error near `;'
/home/tom/.config/mpdnotify/config: line 53: ` if [[ -z ]]; then'
[ 04 Nov 2010 18:02 ] :: error: handle_event() not defined, check your config
[tom@kiwi mpdnotify-git]$ mpdnotify start
/home/tom/.config/mpdnotify/config: line 53: unexpected argument `]]' to conditional unary operator
/home/tom/.config/mpdnotify/config: line 53: syntax error near `;'
/home/tom/.config/mpdnotify/config: line 53: ` if [[ -z ]]; then'
[ 04 Nov 2010 18:04 ] :: error: handle_event() not defined, check your configAm I supposed to change the variable -z is looking for? Is it PID?
Offline
hmm something's odd there (i actually wrote the script that that's based on).
obviously this line is pretty fail:
if [[ -z ]]; then[[ -z "$somevar" ]] checks if a variable has a value. also, in the else he then hardcodes some artist/title info? i think he was testing something at the time you git pulled...
/edit:
and wth is this?
if [ -f "" ]; then rm ""; fi
if [ -f "/" ]; then
cp "/" ""...
Last edited by brisbin33 (2010-11-04 19:16:48)
//github/
Offline
and the hardcoding of mpdPID=17253 seems somewhat suspect
Offline
Soooo, is there another way to get notifications when mpd does something? I'll write it myself but I don't know how to write daemons/check mpd.
Last edited by BaconPie (2010-11-04 19:38:01)
Offline
that one works.
I get an error:
$ sh bashnotify start
bashnotify: line 103: syntax error near unexpected token `<'
bashnotify: line 103: ` done < <(mpc idleloop player) ) &'Copy/paste from here.
I'm not too sure on the bash to fix it...
Lines 91 -> 110 (It doesn't like the one below handle_event()):
type -p handle_event || errorout 'handle_event() not defined, check your config'
}
# }}}
### start/stop deamon {{{
start_daemon() {
[[ -f "$pid" ]] && errorout "file found at $pid, daemon already running?"
# start listening in background
( while read -r; do
handle_event
done < <(mpc idleloop player) ) &
echo $! > "$pid"
}
stop_daemon() {
if [[ -f "$pid" ]]; then
kill $(cat "$pid") || errorout 'error stopping daemon'Last edited by BaconPie (2010-11-04 20:04:28)
Offline
$ sh bashnotify startwhy would you do that? using sh is causing the error (< <( ) is a bashism).
//blue/0/~/ ./bashnotify start
[ 04 Nov 2010 17:15 ] :: NOTE: writing example config to /home/patrick/.bashnotify/config...
[ 04 Nov 2010 17:15 ] :: you should edit this file before starting the deamon//github/
Offline
Today is not my day...
Thanks.
Offline
Just for some closure I edited the handle_event() function to be:
handle_event() {
local songInfo="/home/tom/.bashnotify/songInfo"
mpc | head -1 > $songInfo
notify-send "`cat $songInfo`"
rm -f $songInfo
}It works but it does that annoying this where the notifications get queued up. I guess this is more of a notify-osd thing. How do I fix it so that when I skip songs fast, the notifications come in real time?
Thanks again.
Last edited by BaconPie (2010-11-04 22:23:41)
Offline
Offline
It seems I never really tested the configuration generated with mpdnotify. How very stupid of me.
Let me fix it and upload a new package.
Last edited by kittykatt (2010-11-04 23:03:13)
- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -
Offline
Just for some closure I edited the handle_event() function to be:
handle_event() { local songInfo="/home/tom/.bashnotify/songInfo" mpc | head -1 > $songInfo notify-send "`cat $songInfo`" rm -f $songInfo }It works but it does that annoying this where the notifications get queued up. I guess this is more of a notify-osd thing. How do I fix it so that when I skip songs fast, the notifications come in real time?
Thanks again.
FYI: i think you can just do...
handle_event() { notify-send "$(mpc current)"; }as for your other issues, i dunno.
//github/
Offline
My package mpdnotify-git should be fixed now if you would like to try it out again. ^^:
- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -
Offline
Why not just use (for example) something like sonata and let it show notifications? Since you're comparing it to Rhythmbox, after all....
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
Sonata doesn't support the newer notification system however airo does. I'll be just using that from now on. Thanks to everyone for all the help!
Last edited by BaconPie (2010-11-05 11:42:31)
Offline
pimpd features three monitor modes; you can run it in
daemonized mode, and it'll execute arbitary commands whenever a song change
occurs. Use with dzen2, xosd or your window manager's native hooks for
notifying. It can also output on STDOUT, either with a full backlog or in
'realtime' mode, keeping a single line always updated with the relevant info.
And for the database thingy... you dont need to update all of it, you can cheat
Offline
Pages: 1