4

I have a car stereo that won't play all my mp3s (5k files totalling >32GB). There's probably some sort of parsing or filesystem problem but I can't figure it out (there's no debugging output I can find and I seem to be within the formatting restrictions specified by the user manual) so it only plays artists roughly [0-9A-C].* and some of D.*.

I just want to play all my music on "random all" so the next thing I'm willing to try is to pick some random subset of my music and copy that to a USB stick, and repeat that procedure every week or month or so. I could do something "simple" like

rm -rf /media/foo/*; find . -type f | shuf | head -1000 | while read line; do mkdir -p /media/foo/"${line%/*}"; rsync -av "$line" /media/foo/"$line"; done
but I'd prefer something a little more user-friendly since it won't be me running this command, and of course it would be nice if files that are kept between runs don't have to be deleted then re-copied (my first run with that command took 17 minutes). Is there some better tool or process?

(Incidentally, if you know of an off-the-shelf system that plays oggs, especially one I can buy from a retailer like Crutchfield with an adapter kit for my car, I'd be very interested.)

  • 3
    iTunes smart playlists are great for this sort of thing. You can say things like "Give me a random selection of 5000 songs rated at least 4 stars, not played in the last month." – Warren Young Apr 20 '16 at 06:43
  • @WarrenYoung iTunes work on linux too ? – Archemar Apr 20 '16 at 06:52
  • When I was using iPhone/iPod on Windows, I used CopyTrans to bypass iTune altogether :) http://www.copytrans.net/copytrans/ pretty neat s/w, but it only works on Windows, perhaps it may work via Wine? – fduff Apr 20 '16 at 07:07
  • The while..read is prolly making it 200 times slower than other solutions that wouldn't use that infamous loop. If you have sane file names you could just save them into a text file and then simply use shuf -n 1000 mytextfile to get 1000 random file names that you could then copy to your flash drive with e.g. rsync. You just have to update the text file when you add files to your mp3 collection. – don_crissti Apr 20 '16 at 21:22

1 Answers1

0

No magic bullet, but you could do this to avoid copying again the files that are already there :

Create your playlist on the hard drive first (should be fairly fast especially if you have ssd):

$ rm -rf /tmp/playlist;  mkdir /tmp/playlist
$ find . -type f | shuf | head -1000 | tar -T - -cf - | (cd /tmp/playlist; tar -xvf -)

Then use rsync to synchronize usb stick:

$ rsync -av --delete  /tmp/playlist /media/foo/

With a little udev hacking you could have this happen automatically when usb stick is inserted, pre-generate playlists every week to speed things up (crontab), display a nice progressbar while it's happening and it might even be somewhat user-friendly =)

lemonsqueeze
  • 1,525