Bit disappointed with the RPi community as I've a project but no-one seems to be able to help, I've joined various forums but apparently my project is beyond the reach of any of their members.
I want to use the Pi as a music player in the car (connected to the existing head unit via AUX in) but I don't want a screen on the RPi.
All I want is the RPi to play from an SD card (continue where it left off) when power is turned on and shut off when power is removed.
If I can add a couple of buttons for next and previous track that would be a bonus.
I know I need one of these to safely shut down the Pi but past that I can get no help on which music player to use or how to get it to continue when power is re-applied
https://www.mausberrycircuits.com/c...pply-switches/products/3a-car-supply-switch-1
View attachment 31618
Linux is just a bunch of tools. You should be able to string them together to achieve what you want. There is nothing special about the Pi that you need to go to them for.
mpd (music player daemon) is the package you want to install. You also want to install mpc (music player client) and possibly ncmpc (ncurses music player client).
Configure mpd by editing /etc/mpd.conf
Because you are loading from SD card you want to make sure that is mounting each time the pi starts (different problem) and to a known location.
For the 'playing all music on the device' problem, you will need to execute
mpc --wait update -q; mpc crop -q; mpc listall -q | shuf | mpc add -q; mpc play -q
each time the pi boots.
You want to force a database update.
Crop the play list to the current song.
Add all songs to the playlist.
Play (incase it was at the end of the song and the playlist finished).
This does mean the playlist contains the current playing song twice. Should look at trying to fix that.
Also, the playlist is fixed whilst the pi remains powered. This may or may not be a problem.
You need to configure mpd to loop through the current play list.
You can get keyboard access to the player through ncmpc to go forward/back/vol up/down etc.
--edit-- Removing the dup
mpc --wait update -q; mpc crop -q; mpc listall | shuf | mpc add -q; mpc play -q; mpc current --wait; mpc del 1
We can wait for the current song to change (mpc current --wait) then remove the first item in the playlist (mpc del 1).
The current song could still be anywhere in the playlist but this would do me.