musicbox.sh is a minimalistic music jukebox to be ran on a Linux host. 

This started as a (failed) attempt to get gapless audio playback using mka/mkv containers, but unfortunately PCH's demuxer still insisted on interrupting audio between tracks inside the container so I gave up on it.

Instead I've extended that code to produce a very basic html jukebox (yamj-ish). I've re-used yamj's html and some graphical files (for consistency -- I'm using yamj for movies already). I tried to keep the remote navigation consistent with yamj as well, mind you, red button sorts by artist, green button sorts by album.

The jukebox generates index pages (sorted by artist's name or album title), per-album pages, playlists and slideshow files. I've tested it for mp3, flac and ogg files. It's written in Bash and it's dependencies are:

- mediainfo
- imagemagick
- dos2unix
- zip and php (on the webserver - optional - only if you want to be able to download whole albums as ZIPs) /tmp needs to be writable for that.

Aside from being functional on a Popcorn Hour, it will also be quite handy with a regular PC and a browser. You can "play all" in the browser by clicking on either play button or the album cover. You can also play songs by clicking on the play button next to the song. You can download songs by clicking at song name. You can browse to the folder by clicking on the folder icon. You can also download a single ZIP file with the entire album.

How to prep your music collection:

0) NO SPACES in [b]file[/b] names NO COMMAS (,)
1) NO SPACES and NO QUOTES in [b]directory[/b] names (") NO COMMAS (,)
2) 1 Directory = 1 Album
3) Files must sort in correct order
4) Cover file: cover.jpg inside the album directory. Nothing else will work.
5) Files [b]must[/b] be ID3 tagged. Tags required: Artist, Album Title, Track Title, Track Number.

Example ls -l of a correctly prepped album:

[code]
$ ls -1 Armand_Amar_-_Home_OST

01_-_Home_part_1_(Vocals_Gombodorj_Byambajargal).mp3
02_-_Home_part_2.mp3
03_-_Home_part_3.mp3
04_-_Home_part_4.mp3
05_-_O_(Taken_from__La_Jeune_Fille_et_les_Loups_).mp3
06_-_Life_1.mp3
07_-_Take_the_Earth_(Ney_Seyed_Mohammad_Hanjani).mp3
08_-_Toll_of_Toil.mp3
09_-_Black_Gold_(Violin_Sarah_Nemtanu).mp3
10_-_Chemical_Food.mp3
11_-_Feed_Lots.mp3
12_-_Overproduction.mp3
13_-_Whales_(Vocals_Adele_Carlier).mp3
14_-_Murderous_Catch_(Turkish_Clarinet_Laurent_Clouet).mp3
15_-_Dubai_(Shanghai_Percussion_Ensemble).mp3
16_-_The_Dead_Seas_(Duduk_Levon_Minassian).mp3
17_-_Faster_and_Faster.mp3
18_-_Epi_(Vocals_Enkhjargal_Dandarvaanchig__Ashkan_Kamangari).mp3
19_-_Life_2.mp3
20_-_Wasteland_(Trumpet_Ibrahim_Maalouf).mp3
21_-_Rake_the_Forest_(Didgeridoo_Phillip_Peris).mp3
22_-_The_Desert_(Turkish_Clarinet_Laurent_Clouet).mp3
23_-_Fire_(Bass_&_Octobass_Henri_Tournier).mp3
24_-_Cum_Dederit_(Vocals_Sandrine_Piau).mp3
cover.jpg
[/code]

I'm using Amarok to tag my files automatically using MusicBrainz and when exported to collection (make sure you check the box to replace spaces with underscores) it is perfectly prepped for musicbox.sh -- you don't need to do anything but plonk the cover.jpg file in.

How to set up:

0) install dependencies,
1) download https://files.warwick.ac.uk/grok/files/musicbox-X.Y.tar.bz2 and unpack to location of your choice,
2) edit the musicbox.conf, especially the first two variables,
3) make sure the user you're running it as has write access to your music repo (lame, I know),
3) run "sh musicbox.sh"
4) ...
5) Profit!

Now, musicbox.sh is not very smart. It will happily continue on broken or missing files. There are quite a few assumptions in the script that could use ironing out. Also, it's not the prettiest of bash files (I'm using cat <<EOF... a lot :) but... it works for me. I decided to share it, perhaps other Linux users may find it useful.

I don't think I'll be working on it a lot more, even if it's quite basic when it comes to features, but it does what I need. One of the missing features is lack of "filter by letter" links on top of the browsing page, but I didn't need it too much. The code is Public Domain, so feel free to do with it whatever you want. 

Some screenshots (note that they're from a browser, not PCH, so they're slightly off):

Albums browser: http://www.uploadandgo.com/images/musicbox1.jpg
Album page: http://www.uploadandgo.com/images/musicbox2.jpg
Slideshow when playing: http://www.uploadandgo.com/images/musicbox3.jpg

Since I'm using pod files, the |<< and >>| buttons on your remote will work as expected, the song title will change as you skip between songs.

That's all.
