RaspyFi - Topic: My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/ Simple:Press Version 5.2.6 commentator on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1236 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1236 That's scheme of setup, which I'm going to implement inside my car, I actually ordered everything on amazon and it'll arrive on Thursday and I can start my test.
http://s017.radikal.ru/i409/1309/25/9bec80ee3648.png

Any comments appreciated

]]>
Tue, 24 Sep 2013 16:37:35 +0200
commentator on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1209 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1209 Didn't you try to use this software for airplay?
http://www.raspberrypi.org/php.....38;t=49668

It looks really nice on youtube videos, I asked them for demo.

I'm really intrested to repeat your configuration, but in my case the main aim is to use airplay to mirror navigation software from iphone to head unit in the car, I plan to use RCA output?

Maybe you can make some tests on your setup (i.e. check Airplay mirroring, if you have a monitor to hook up through RCA).

]]>
Mon, 23 Sep 2013 03:47:26 +0200
admin on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1139 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1139 Try to reinstall the firmware of your dongle's chipset , and let me know

]]>
Wed, 18 Sep 2013 13:58:56 +0200
shifter2600 on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1125 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/page-2/#p1125 I am using the New Raspyfi 1.0 and the WIFI is configured now using wicd-curses I am not sure if what you have listed here will work anymore in the new version. Correct me if I am wrong.
I am also struggling to get a Ad-hoc wifi connection established to the PI. I found the O argument in wicd-curses to set up a ad-hoc but it fails to take and drops as soon as it is started.

I do have the PI already connecting to my WIFI hotspot that was alright but it increases the boot time to use it.
I would rather just control it over ad-hoc wifi direct connection to the Pi from my Phone.

]]>
Wed, 18 Sep 2013 05:30:23 +0200
craigcurtin on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p361 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p361

aht961 said

craigcurtin said
The TPLink router runs on 5V USB so you would just power it from a 12V to USB converter
Craig

That sounds superb - unfortunately, seems to be unavailable in Finland. I have looked for such a "mobile" small router to no avail. Now when I realize that such a 5V/USB router is available at market and with that price tag - I definitely would go for it instead of two usb wifi dongles as I have used. This one you can take with you anywhere you go - i.e. no need to leave it in the car if you did not want to.

It is available on EBAY for dirt cheap and shipping is no issue - they even preload the latest OpenWrt on it.

I mount mine up in the top corner of my windscreen. When i get in the car i just plug the USB 3G/4G dongle into a hub i have mounted in the car - ready to go !

Craig

]]>
Wed, 05 Jun 2013 11:11:06 +0200
aht961 on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p347 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p347

craigcurtin said
The TPLink router runs on 5V USB so you would just power it from a 12V to USB converter
Craig

That sounds superb - unfortunately, seems to be unavailable in Finland. I have looked for such a "mobile" small router to no avail. Now when I realize that such a 5V/USB router is available at market and with that price tag - I definitely would go for it instead of two usb wifi dongles as I have used. This one you can take with you anywhere you go - i.e. no need to leave it in the car if you did not want to.

]]>
Mon, 03 Jun 2013 18:44:05 +0200
craigcurtin on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p345 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p345

kew1 said

So can we use a Venice 7 module (or even a DAB+ usb stick :-) in a r-pi car computer a la mp3car.com, yet?

Hey Craig, does your curtin refer to the suburb in the ACT? Or are you just fond of the old PM?

Both i guess - he was a distant relative and the suburb is named after him !

CraigSurprised

]]>
Mon, 03 Jun 2013 04:36:11 +0200
craigcurtin on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p344 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p344

aht961 said

Thank you for your interest in the project. Nice suggestions. I have few comments, though.

craigcurtin said
One option that you could look at to simplify some of this would be to use a 3g/wireless router - like the TPLink wr-703n - (around $25) - this would connect via ethernet to your PI and will auto connect to your home network through Wireless when in range and through 3G when on the road - this would act as your incar Wifi access point so your head end (android etc) could access the PI over this.

The logic behind Pi is to keep the budget at minimum. If you add a 3G router, you need an additional 3G subscription. Taking into account the amount of time you spend in the car, at least to me, sounds not very practical.

The second problem comes with the power for the router. Then you will need probably a 12V/220V inverter.

If ultimate audio quality was your goal then put a 2nd Pi in the car to act as a NAS with USB HDD and a small ethernet switch to interconnect everything !

Why do you think that adding another Pi would improve the audio quality?

TPlink as Wirelesss Hub/access point and 3G router - this will be permanently mounted to my windscreen for best range
Small 5 port ethernet switch headless Raspberry pi as MPD player with USB DAC - connected to ethernet switch 2nd pi as NAS with 2.5 inch HDD and ethernet connected to switch

As I have said, this is doable if you want to dedicate a 3G subscription for your auto-PI. But if I were you and willing to have an internet connection dedicated to PI in the car, then I would go for a 7" touchscreen monitor for PI and forget the mobile phone and remote connection. Then you will have your HDD, USB DAC attached and also could directly connect to spotify if you wanted, The only reason I needed to have this client/AP options was to use the mobile phone for internet connection.

I am still working out the power setup but as i will have an android in the car for some other automation projects may leave the TPlink permanently powered from a small 12v (7.2ah) battery - this would then be able to receive a command through ssh to wake the PI - which would go to the android to enable a relay to turn on power to the Pi.

Very interesting.

Rysnc will then run from my music collection in the house and download any updates to the Pi NAS ready for the next time i drive off.

I do that by just taking the small 32GB USB drive home or bringing the laptop to the car while I am still in the garden Wink

The TPLink router runs on 5V USB so you would just power it from a 12V to USB converter

You are right about the additional data subscription for a Sim for a 3G dongle - however note this is just a 3G/4G dongle that plugs into a USB port on the TPLink router - i currently carry one of these around with me for my laptop connection so it is no additional cost - YMMV - it sounded like it simplified a lot of the issues

My understanding was that there were USB issues on the PI and sharing a high throughput device like a Hard disk and trying to use a DAC on the same USB bus was not thought to be a good idea ?

Craig

]]>
Mon, 03 Jun 2013 04:33:58 +0200
aht961 on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p342 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p342 Thank you for your interest in the project. Nice suggestions. I have few comments, though.

craigcurtin said
One option that you could look at to simplify some of this would be to use a 3g/wireless router - like the TPLink wr-703n - (around $25) - this would connect via ethernet to your PI and will auto connect to your home network through Wireless when in range and through 3G when on the road - this would act as your incar Wifi access point so your head end (android etc) could access the PI over this.

The logic behind Pi is to keep the budget at minimum. If you add a 3G router, you need an additional 3G subscription. Taking into account the amount of time you spend in the car, at least to me, sounds not very practical.

The second problem comes with the power for the router. Then you will need probably a 12V/220V inverter.

If ultimate audio quality was your goal then put a 2nd Pi in the car to act as a NAS with USB HDD and a small ethernet switch to interconnect everything !

Why do you think that adding another Pi would improve the audio quality?

TPlink as Wirelesss Hub/access point and 3G router - this will be permanently mounted to my windscreen for best range
Small 5 port ethernet switch headless Raspberry pi as MPD player with USB DAC - connected to ethernet switch 2nd pi as NAS with 2.5 inch HDD and ethernet connected to switch

As I have said, this is doable if you want to dedicate a 3G subscription for your auto-PI. But if I were you and willing to have an internet connection dedicated to PI in the car, then I would go for a 7" touchscreen monitor for PI and forget the mobile phone and remote connection. Then you will have your HDD, USB DAC attached and also could directly connect to spotify if you wanted, The only reason I needed to have this client/AP options was to use the mobile phone for internet connection.

I am still working out the power setup but as i will have an android in the car for some other automation projects may leave the TPlink permanently powered from a small 12v (7.2ah) battery - this would then be able to receive a command through ssh to wake the PI - which would go to the android to enable a relay to turn on power to the Pi.

Very interesting.

Rysnc will then run from my music collection in the house and download any updates to the Pi NAS ready for the next time i drive off.

I do that by just taking the small 32GB USB drive home or bringing the laptop to the car while I am still in the garden Wink

]]>
Sun, 02 Jun 2013 16:10:05 +0200
kew1 on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p335 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p335 So can we use a Venice 7 module (or even a DAB+ usb stick :-) in a r-pi car computer a la mp3car.com, yet?

Hey Craig, does your curtin refer to the suburb in the ACT? Or are you just fond of the old PM?

]]>
Sat, 01 Jun 2013 14:57:32 +0200
admin on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p334 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p334 This is getting amazingly interesting!!!

]]>
Sat, 01 Jun 2013 13:52:44 +0200
craigcurtin on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p324 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p324 One option that you could look at to simplify some of this would be to use a 3g/wireless router - like the TPLink wr-703n - (around $25) - this would connect via ethernet to your PI and will auto connect to your home network through Wireless when in range and through 3G when on the road - this would act as your incar Wifi access point so your head end (android etc) could access the PI over this.

You could also use this to access the Pi remotely - leave this powered all the time and use one of the USB TTL lines to wake up the pi remotely - you would then be able to remotely download/sync music to the Pi .

If ultimate audio quality was your goal then put a 2nd Pi in the car to act as a NAS with USB HDD and a small ethernet switch to interconnect everything !

May simplify much of the work you have done - but i like what you have done and will use is as the base of what i intend to build for my car going forward - my plan is as follows

TPlink as Wirelesss Hub/access point and 3G router - this will be permanently mounted to my windscreen for best range
Small 5 port ethernet switch
headless Raspberry pi as MPD player with USB DAC - connected to ethernet switch
2nd pi as NAS with 2.5 inch HDD and ethernet connected to switch

I am still working out the power setup but as i will have an android in the car for some other automation projects may leave the TPlink permanently powered from a small 12v (7.2ah) battery - this would then be able to receive a command through ssh to wake the PI - which would go to the android to enable a relay to turn on power to the Pi.

Rysnc will then run from my music collection in the house and download any updates to the Pi NAS ready for the next time i drive off.

In Australia our 3g is patchy - but my hope is that i can also get spotify working reliably.

Craig

]]>
Sat, 01 Jun 2013 05:15:10 +0200
aht961 on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p232 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p232 Part 4: A SCRIPT FOR NOTIFICATION & ALBUM COVER ART RETRIEVAL

aht961 said
TO - DO LIST

So far I am very happy with this setting and everything is sorted out automatically (almost). Now I want to have a nice full-window banner showing the "Now Playing" INFO with song & artist name, duration, number of the track and the album cover on the server-side. This should be displayed on the attached 7" display. I have been reading and doing some testing. So far, I could only get an info buble with basic information. However, I could not get the album cover displayed yet. In additon, the present banner is very small and located at the upper right corner of the monitor. Any suggestions are very welcome. Then the project will be finally ready.

I am referring to my post above. This was the missing part of the project. Now I have found a nice solution, which is quite nice, however, requires further improvements. I will describe the process in the following for those who are willing to try it.

The basics are straight forward. When MPD plays a song, a notification bubble with an album cover, song and related info is displayed on the upper right corner for a 5 seconds. If a cover could not be found in the default folder, a query is made to http://www.albumart.org and if a match is found it is downloaded in the default directory. The script uses for displaying the notification (notify-osd).

We need these:
mpc #Required (Command line MPD client: probably you already have)
Notify-OSD#Required (check if you have it already installed)
libnotify-bin #Required (not very sure about this, since I have installed this earlier)
ImageMagick #Optional
Ario #Optional (if you want to download cover art)

Lets install these
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install packagename
Substitute package name with: mpc notify-osd libnotify-bin imagemagick ario

I have been looking for a ready solution and tested a few options. Only with a 3 year old script by pbrisbin and KittyKat I have managed to have the notification displayed but with no album cover. There were few typo mistakes and changes in the URL and I have changed them. Before running the script, first install the packages above and TEST if notification is functioning.

notify-send "Hello World"

You should see this at your display's upper right corner. If you don't see, you should try to sort this out before you proceed with the following. I was using a VNC connection and could not see anything. I had to define my display before the notify-send command.

For VNC connection it was DISPLAY=:1 and for the primary attached monitor DISPLAY=:0.0
Try both and check which one works for you. So, first you export the display then the command

export DISPLAY=:1; notify-send "hello" or
export DISPLAY=:0.0; notify-send "hello"

You see it on the monitor - great, now you are ready to proceed.

A. CREATE THE NOTIFICATION SCRIPT

Copy the code below and save it as mpdnotify at your home directory /home/pi

###########################################################################

#!/bin/bash
###########################################################################
# pbrisbin 2010
# http://pbrisbin.com:8080/bin/bashnotify
# modify the config after it's written!
#
# modified by KittyKatt (http://www.silverirc.com/kittykatt/) 2010
#
# modified and few bugs corrected by AT aht Tekay @ 2013
###########################################################################
### utilities {{{
message() { echo 'usage: mpdnotify [start|stop|restart]'; exit 1; }
logger() { echo "$(date +'[ %d %b %Y %H:%M ]') :: $*" | tee -a "$log"; }
errorout() { logger "error: $*"; exit 1; }
# }}}
### write config file {{{
write_config() {
if [ ! -f "$config" ]; then
logger "NOTE: writing example config to $config..."
logger "you should edit this file before starting the deamon"
cat > "$config" << EOF
#!/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 $mydir
# Constants
if [ "\$MPD_HOST" ]; then HOST="\$MPD_HOST"; else HOST="localhost"; fi
if [ "\$MPD_PORT" ]; then PORT="\$MPD_PORT"; else PORT="6600"; fi
MPD_TCP="/dev/tcp/\$HOST/\$PORT"
coverDir="\$HOME/.covers" # THE DIR FOR YOUR COVERS
tmpCover="/tmp/cover"
baseCover="\$HOME/extras/base.png" # THE DIR FOR YOUR DEFAULT IMAGES
topCover="\$HOME/extras/top.png" # THE DIR FOR YOUR DEFAULT IMAGES
noCover="\$HOME/extras/NOCOVER.png" # THE DIR FOR YOUR DEFAULT IMAGES
myPID="\$HOME/.config/mpdnotify/pid"
mpdPID=\$(pidof mpd)
mpdArtist="Could not find Artist's name"
mpdTitle="Could not find Song's title"
mpdAlbum="Could not find Album's name"
mpcLength="Could not find Song's length"
mpcInfo="Cound not find Song's info"
showCover="true"
expireTime="5000"
#logout="true"

function mpd_sndcommmand() {
# \$1 command
exec 5 \$MPD_TCP 2>/dev/null
[[ \$? -gt 0 ]] && return 1
echo \$1 >&5
echo "close" >&5
tmp=\$(cat &-
_ret=\$(head -n -1 <<< "\$tmp" | tail -n +2)
return 0
}

function mpd_getinfo() {
mpd_sndcommmand currentsong
[[ \$? -gt 0 ]] && return 1
_tmp=\$_ret
mpdTitle=\$(grep "^Title: " <</dev/null | sed "s/Title: //")
mpdArtist=\$(grep "^Artist: " <</dev/null | sed "s/Artist: //")
mpdAlbum=\$(grep "^Album: " <</dev/null | sed "s/Album: //")
_songtime=\$(grep "^Time: " <</dev/null | sed "s/Time: //" | cut -f 1 -d :)
(( _mm=\$_songtime / 60 ))
[[ \${#_mm} -eq 1 ]] && _mm="0\$_mm"
(( _ss=\$_songtime - \$_mm * 60 ))
[[ \${#_ss} -eq 1 ]] && _ss="0\$_ss"
mpdLength="\$_mm:\$_ss"
mpd_sndcommmand "status"
_tmp=\$_ret
mpdSongID=\$(grep "^songid: " <</dev/null | sed "s/songid: //")
mpdPlaylistL=\$(grep "^playlistlength: " <</dev/null | sed "s/playlistlength: //")
}

function fetch_cover() {
###################################################################################
# CHANGE THE FOLLOWING LINE TO MATCH YOUR COVER TAG in coverDir

coverjpg="\$coverDir/\${mpdArtist}-\${mpdAlbum}.jpg"

# If you have changed this, you should change the URL below as well
###################################################################################
album=\$1
file="\$coverjpg"
if [ ! -f "\$file" ] ; then
logger "\$file is not in covers... " >/dev/null
###################################################################################
# CHANGE THE FOLLOWING IF YOU HAVE CHANGED THE COVER TAG ABOVE OR IF THE URL FOR
# SEARCHING AT albumart.org changes

url="http://www.albumart.org/index.php?skey=\${mpdArtist// /+}-\${mpdAlbum// /+}&itempage=1&newsearch=1&searchindex=Music"

###################################################################################
cover_url=\$(curl -s "\$url" | awk -F 'src=' '/zoom-icon.jpg/ {print \$2}' | cut -d '"' -f 2 | head -n1)
if [ -n "\$cover_url" ]; then
logger "\$file retrieved and placed in covers directory..." >/dev/null
wget -q -O "\$file" "\$cover_url"
else
logger "ERROR: Album cover not found online. Searched for: \${album// /+}" >/dev/null
fi
fi
}

handle_event() {
###################################################################################
# CHANGE THE FOLLOWING LINE TO MATCH YOUR COVER TAG in coverDir

coverjpg="\$coverDir/\${mpdArtist}-\${mpdAlbum}.jpg"

# NO CHANGES REQUIRED BELOW
###################################################################################
if [[ -z \$mpdPID ]]; then
echo "MPD is not currently running!"
if [[ -f "\$myPID" ]]; then
rm "\$myPID"
fi
exit
else
mpd_getinfo
if [ "\${showCover}" = "true" ]; then
if [ -f "/tmp/cover" ]; then rm /tmp/cover; fi
if [ -f "\$coverjpg" ]; then
cp "\$coverjpg" /tmp/cover
else
fetch_cover "\$mpdAlbum"
if [ -f "\$coverDir/\$mpdAlbum" ]; then
cp "\$coverDir/\$mpdAlbum" /tmp/cover
else
cp "\$noCover" /tmp/cover
fi
fi
mogrify -resize 144x144! \$tmpCover
# convert \$baseCover "\$tmpCover" -geometry +4+3 -composite \$topCover -geometry +0+0 -composite "\$tmpCover"
mpdAlbum=\$(echo "\$mpdAlbum" | sed -e 's/&/&/')
mpdTitle=\$(echo "\$mpdTitle" | sed -e 's/&/&/')
mpdArtist=\$(echo "\$mpdArtist" | sed -e 's/&/&/')
[[ "\${#mpdArtist}" -gt "25" ]] && mpdArtist=\$(echo "\${mpdArtist:0:25}...")
[[ "\${#mpdTitle}" -gt "25" ]] && mpdTitle=\$(echo "\${mpdTitle:0:25}...")
[[ "\${#mpdAlbum}" -gt "25" ]] && mpdAlbum=\$(echo "\${mpdAlbum:0:25}...")
notify-send --expire-time="\${expireTime}" -i "\${tmpCover}" "$(echo "${mpdTitle}")" "\$(echo "By: \${mpdArtist}"; echo "From: \${mpdAlbum}"; echo "Length: \${mpdLength}"; echo "Position: \${mpdSongID} / \${mpdPlaylistL}")"
else
notify-send --expire-time="\${expireTime}" "$(echo "${mpdTitle}")" "\$(echo "By: \${mpdArtist}"; echo "From: \${mpdAlbum}"; echo "Length: \${mpdLength}"; echo "Position: \${mpdSongID} / \${mpdPlaylistL}")"
fi
if [ "\$logout" == "true" ]; then
echo -e "\$mpdTitle \n \$mpdArtist \n \$mpdAlbum \n" > \$HOME/mpdout
fi
fi
}

EOF
exit 0
fi
. "$config"
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 < "$pid"
}

stop_daemon() {
if [ -f "$pid" ]; then
kill $(cat "$pid") || errorout 'error stopping daemon'

rm "$pid"
fi
}

# }}}

### constants

if [ "$XDG_CONFIG_HOME" ]; then
mydir="$XDG_CONFIG_HOME/mpdnotify"
else
mydir="$HOME/.config/mpdnotify"
fi
config="$mydir/config"
pid="$mydir/pid"
log="$mydir/log"
pipe="$mydir/pipe"

### run it

if [ ! -d "$mydir" ]; then
mkdir -p "$mydir" || errorout "unable to create my dir $mydir"
fi

write_config

case "$1" in
start) start_daemon ;;
stop) stop_daemon ;;
restart) stop_daemon; sleep 3; start_daemon ;;
status) handle_event ;;
*) message ;;
esac

#######################################################################
# E N D O F S C R I P T
#######################################################################

How to run: Install mpdnotify at your home directory and run it as a daemon:
Remember to make it executable first

sudo chmod +x /home/pi/mpdnotify

Then start it:

/home/pi/mpdnotify start

At the first run, you will have the configuration files written at /home/pi/.config/mpdnotify. Adjust the directories in the config file.

You won't be able to see anything yet, since we must add EXPORT DISPLAY commands and get rid of the PID file written from the last session at the next boot. In addition, we want to have this run automatically at each boot. Now we will go through these steps.

B. MAKE A STARTUP SCRIPT AND MAKE IT RUN AFTER YOU HAVE LOGGED TO YOUR LXDE DESKTOP

I have made a script for this. Copy the code below as start_mpdnotify.sh and install it at /home/pi
Adjust the DISPLAY= value if the default does not work.

#################################################################################

#!/bin/bash
######################################################
# By AT aht Tekay @ 2013
# Starting MPD-NOTIFY
######################################################
# SETTINGS
lockfile='/home/pi/.config/mpdnotify/pid'
# Change this to match the dir of your lock file
# You may need to change the DISPLAY number below
######################################################
export DISPLAY=:0.0
if [ -e $lockfile ]; then
pid=`cat $lockfile`
rm $lockfile
export DISPLAY=:0.0
/home/pi/mpdnotify start
exit 1
else
export DISPLAY=:0.0
/home/pi/mpdnotify start
fi
exit 0

#############################################################################
# E N D O F S C R I P T
#############################################################################

We need to run this ONLY after the LXDE Desktop session is started. It won't function if you addd it at e.g. /etc/rc.local. Remember this.

Go to /home/pi/.config/autostart, create a .desktop file including the details below.

cd ~/.config/autostart
touch mpdnotify.desktop

using e.g. nano enter the following lines in the mpdnotify.desktop you have just created
nano mpdnotify.desktop

[Desktop Entry]
Type=Application
Name=MPD Notification
Comment=Starts the now playing notification in MPD
Exec=/home/pi/start_mpdnotify.sh

Save. Go to your desktop menu using GUI: > Preferences > Desktop Session Settings. There you will see a NEW shortcut named MPD Notification: Activate. This will run the script after reboot and the initiation of the LXDE session.

We are all setup. REBOOT and start MPD if it is not already running. After each song you will se a nice notification with album cover, name, title, artist, track. etc. In addition, make an image file named NOCOVER.png and put it in /home/pi/extras. This will be showed if the album does not have an image to display. If you have album covers, you put them in your coverDir="$HOME/.covers". If you don't have. Install, ARIO and install covers usng it. Thereafter, copy all images from ARIO's /covers folder to your default .cover folder. Ario tags the cover image as Artist Group Name-Album Name.jpg. If yours is different, then you should obviously make the adjustments in the scripts above.

I think this should be a selectable default option in e.g. RASPYFI :)

IMPORTANT NOTE - EDIT:
There is a funny smiley in the middle of the code where reads:
_songtime=\$(grep "^Time: " <</dev/null | sed "s/Time: //" | cut -f 1 -d * :) This does not belong there!!!! Add ":" ")" there where the * is but nothing else. The forum is not very friendly for posting codes or styling :(

MISSION ACCOMPLISHED - GOOD LUCK

]]>
Wed, 15 May 2013 19:45:31 +0200
aht961 on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p230 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p230

guussie said
- if I count correctly you have 4 usb devices. How do you connect them? I assume you use a powered usb hub? Is that why you need the 2-port lighter adapter? I have been thinking about building a power supply myself using the instructions from Issue 6 of the MagPi.

You are very welcome. That is why I have a Y-splitter (was meant initially for my external usb HDD attached to my laptop). 2-port 5V/2A USB adapter is attached to a single lighter port. One feeds directly PI as usual using the micro-USB. The other port is attached to the powered hub using the POWER end of the USB Y-splitter cable. The other end (host) of the splitter goes to the powered hub and the other USB DATA cable to the backport of the PI. This Y-cable powers also the PI using the back port (so if I did not have so many adapters, I could go with this alone). One of the USB wifi dongles could draw 500mA and the other 450mA. So, this 500mA unit is attached to the second USB port of the PI. The sound card (200mA), 32GB usb stick (150mA) and the other wifi card are all attached to the hub. Check your devices power consumption typing usb-devices Since you don't need the other wifi dongle, just stick the one you have to PI and both the sound card and the memory stick to the hub.

- does your installation support ALAC? If not, can you suggest how to get that working? In any case, I will try this weekend.

All of my rips are using Apple lossless, so there should not be any issue there.
Good luck - let us know of the progress.

Aht

]]>
Wed, 15 May 2013 15:45:10 +0200
guussie on My humble Wifi Car Music Streamer http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p229 Your setup, your sound, your place on hearth http://www.raspyfi.com/forum/your-setup-your-sound-your-place-on-hearth/my-humble-wifi-car-music-streamer/#p229 Hello aht961,

Thanks for this great post! It will help me to put my car music streamer together.

Personally I will do away with the hotspot functionality. I live in Belgium and my streamer will mostly be used during holidays outside belgium where I do not use 3G because of the roaming charges.

Could you please explain the following in more detail:

- if I count correctly you have 4 usb devices. How do you connect them? I assume you use a powered usb hub? Is that why you need the 2-port lighter adapter? I have been thinking about building a power supply myself using the instructions from Issue 6 of the MagPi. In that case I would need two probably. The reason for building one myself is to make sure to get the best audio quality from the Pi.
- does your installation support ALAC? If not, can you suggest how to get that working? In any case, I will try this weekend.

Thanks again!

]]>
Wed, 15 May 2013 12:32:58 +0200