diff --git a/audio-manager.rkt b/audio-manager.rkt index 51824b8..16f27a7 100644 --- a/audio-manager.rkt +++ b/audio-manager.rkt @@ -72,7 +72,7 @@ (eq? state 'changed) (eq? state 'new))))) - (define (needs-copying? path info) + (define (needs-copying? path info #:copy [copy 'pure]) (let ((state (hash-ref info 'file-db #f))) (and (eq? (hash-ref info 'type #f) 'file) (not (eq? state 'deleted)) @@ -81,7 +81,10 @@ (if (eq? path-part #f) #f (if (and (eq? state 'unchanged) - (file-exists? (build-path opus-path path-part))) + (let ((file (if (eq? copy 'pure) + (build-path opus-path path-part) + (path-replace-extension (build-path opus-path path-part) #".opus")))) + (file-exists? file))) #f #t) ) @@ -236,7 +239,8 @@ ;; Converteer naar opus indien nodig en flac. (define (to-opus base-path path info) - (when (and (needs-processing? path info) + (when (and (or (needs-processing? path info) + (needs-copying? path info #:copy 'opus)) (flac? path info)) (let ((path-part (get-path-part info))) (unless (eq? path-part #f) diff --git a/audio-manager.sh b/audio-manager.sh index 6773e6e..e279803 100755 --- a/audio-manager.sh +++ b/audio-manager.sh @@ -3,7 +3,12 @@ RKT=/usr/local/bin/racket MYNAME=`basename $0` MYDIR=`echo $0 | sed s/$MYNAME//` cd $MYDIR -$RKT -e "(enter! \"audio-manager.rkt\") (audio-manager \"/mnt/music\" \"/mnt/music-opus\" #:log-level 'info) (exit)" +$RKT -e "(enter! \"audio-manager.rkt\") (audio-manager \"/mnt/music\" \"/data/cloud/hans/files/muziek-opus\" #:log-level 'info) (exit)" + +pushd /data/www/cloud +php occ files:scan hans --path="/hans/files/muziek-opus" +popd +