option to skip directories
This commit is contained in:
parent
982f2fe878
commit
bc8d73d2d9
13
atom
13
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 <<EOF
|
||||
|
||||
@ -40,6 +40,8 @@ Sections:
|
||||
|
||||
* path <directory>: String. The root of your collection.
|
||||
Default: /var/lib/mpd/music
|
||||
* skip <directory>: String. Files in <directory> will be ignored. Note that
|
||||
<directory> can be any expression accepted by find.
|
||||
|
||||
[<some arbitrary string>]
|
||||
Each section not named 'general' or 'source' will define a new destination.
|
||||
|
||||
@ -7,6 +7,9 @@ debug 0
|
||||
|
||||
[source]
|
||||
path /var/lib/mpd/music
|
||||
skip /last
|
||||
skip /lastfm
|
||||
skip /zzz-atrier
|
||||
|
||||
[Ogg]
|
||||
path /mnt/Musique-OggQ2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user