From bc8d73d2d9c8d1166d48eed097f48010b52eb8ee Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sat, 9 Mar 2013 01:44:41 +0100 Subject: [PATCH] option to skip directories --- atom | 13 ++++++++++++- doc/config | 2 ++ doc/example.cfg | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/atom b/atom index db35c94..18bee0d 100755 --- a/atom +++ b/atom @@ -116,6 +116,9 @@ getConfigSource() { 'path') sourcepath="$value" ;; + 'skip') + skippeddirectories+=( "$value" ) + ;; esac } @@ -542,6 +545,10 @@ createDestinations() { getFiles() { scantime=$(date +%s) + for prune_expression in "${skippeddirectories[@]}" + do + prunes+="-path $sourcepath$prune_expression -prune -o " + done # We probably have thousands of files, don't waste time on disk writes echo 'BEGIN TRANSACTION;' >&3 while read time size filename @@ -587,7 +594,7 @@ getFiles() { *) ;; esac done < <( - find "$sourcepath" -type f -printf "%T@ %s %P\n" + find "$sourcepath" $prunes -type f -printf "%T@ %s %P\n" ) echo 'COMMIT;' >&3 echo -e "\r$count files found, ${new:=0} new or changed." @@ -955,6 +962,10 @@ General|Load|$maxload |Debug|$debug Source|Path|$sourcepath EOF +for prune_expression in "${skippeddirectories[@]}" +do + echo "|Skipped directory|$prune_expression" +done for destination in ${!destinationpath[@]} do cat <: String. The root of your collection. Default: /var/lib/mpd/music + * skip : String. Files in will be ignored. Note that + can be any expression accepted by find. [] Each section not named 'general' or 'source' will define a new destination. diff --git a/doc/example.cfg b/doc/example.cfg index 4e59c8c..9a116e7 100644 --- a/doc/example.cfg +++ b/doc/example.cfg @@ -7,6 +7,9 @@ debug 0 [source] path /var/lib/mpd/music +skip /last +skip /lastfm +skip /zzz-atrier [Ogg] path /mnt/Musique-OggQ2