johnsu01 (johnsu01) wrote,
johnsu01
johnsu01

  • Music:

More better: playing new music with mpd

Someone pointed out to me that my previous way of building a playlist of all the music I'd acquired in the last 31 days didn't preserve the album track order. I didn't think to check this (because I mainly had in mind to listen on shuffle anyway), but it turns out that find doesn't return the results in directory order. So this new version fixes that by piping through sort, and now takes an argument to specify a different number of days than 31. I think I also had the pruning business wrong before.

#!/bin/bash

MUSIC_DIR="/mnt/enclosure/music"

days=31

if [ $1 ]; then days=$1; fi;

cd $MUSIC_DIR

tracks=$(find encoded -path 'encoded/podcasts' -prune -o \
    -type f -mtime -$days -print | sort)

mpc add $tracks
Tags: bash, code, more better, mpc, mpd, music, shell, unix
Subscribe
  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 4 comments