You are not logged in.

#1 2010-03-02 20:04:17

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Bashnotify - a bash notification deamon for mpd song changes

About
Not sure if it's been done before, but hearing someone mention it in IRC i was motivated to write a wrapper around mpc idleloop to spawn an arbitrary command (well a function) on mpd changes (including track changes).

The idea was to keep it simple and customizable. The user gets a config file that simply needs to define the handle_event() function; this can be any valid bash.

The example config pops up a dzen notification for 3 seconds showing Artist - Title.

Depending on interest i'll definitely bug-fix, possibly feature-add, and maybe upload to AUR

Webpage
Longer writeup, screenshots -- coming soon.

Get it

wget -q -O ./bashnotify http://pbrisbin.com:8080/bin/bashnotify
chmod +x ./bashnotify
./bashnotify
[ 02 Mar 2010 14:58 ] :: NOTE: writing example config to /home/username/.bashnotify/config...
[ 02 Mar 2010 14:58 ] :: you should edit this file before starting the deamon
vim ~/.bashnotify/config
...
./bashnotify start
mpc next

Get rid of it

./bashnotify stop
rm -r ./{,.}bashnotify

Offline

#2 2010-03-04 12:46:28

jack.mitchell
Member
From: Ely, Cambridgeshire, UK
Registered: 2008-08-28
Posts: 156
Website

Re: Bashnotify - a bash notification deamon for mpd song changes

I know I could easily change it but could you put the config file in $XDG_CONFIG or at least .config/bashnotify?

Cheers,
Jack.

Nice little script btw smile

Last edited by jack.mitchell (2010-03-04 12:47:00)

Offline

#3 2010-03-04 14:12:24

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Bashnotify - a bash notification deamon for mpd song changes

change line 120 to

#mydir="$HOME/.bashnotify"
mydir="$XDG_CONFIG_HOME/bashnotify"

then you'll get ~/.config/bashnotify/config (similar to uzbl).

Offline

#4 2010-03-04 21:04:56

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: Bashnotify - a bash notification deamon for mpd song changes

It's been done before. albeit in C

http://alip.github.com/mpdcron/

* Uses mpd's idle mode.
    * Calls hooks depending on the event.
    * Sets special environment variables to pass data to the hooks.
    * Optional support for modules via GModule.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

Board footer

Powered by FluxBB