keep original file info in file-walker and make sure changed files are processed properly
This commit is contained in:
+14
-13
@@ -59,7 +59,7 @@
|
||||
(eq? state 'changed)
|
||||
(eq? state 'new)))))
|
||||
|
||||
(define (needs-copying? info)
|
||||
(define (needs-copying? path info)
|
||||
(let ((state (hash-ref info 'file-db #f)))
|
||||
(and (eq? (hash-ref info 'type #f) 'file)
|
||||
(not (eq? state 'deleted))
|
||||
@@ -99,12 +99,13 @@
|
||||
(eq? (hash-ref info 'ext) 'flac)))
|
||||
|
||||
(define (flac? path info)
|
||||
(when (presumed-flac? info)
|
||||
(if (presumed-flac? info)
|
||||
(let ((s (hash-ref info 'sniffed #f)))
|
||||
(when (eq? s #f)
|
||||
(set! s (audio-sniff-format path))
|
||||
(hash-set! info 'sniffed s))
|
||||
(eq? s 'flac))))
|
||||
(eq? s 'flac))
|
||||
#f))
|
||||
|
||||
(define (rep-id3 path)
|
||||
(set! report-flacs-with-id3
|
||||
@@ -136,7 +137,10 @@
|
||||
|
||||
(define (flac-with-id3 base-path path info)
|
||||
(if (or (needs-processing? path info)
|
||||
(eq? (hash-ref info 'sniffed #f) #f))
|
||||
(and
|
||||
(eq? (hash-ref info 'type #f) 'file)
|
||||
(eq? (hash-ref info 'sniffed #f) #f)
|
||||
(not (deleted? info))))
|
||||
(let ((ext (hash-ref info 'ext)))
|
||||
(when (memq ext known-audio-exts)
|
||||
(let ((sniffed (audio-sniff-format path)))
|
||||
@@ -152,12 +156,9 @@
|
||||
|
||||
(define (flac-khz-bits base-path path info)
|
||||
(when (and (needs-processing? path info) (flac? path info))
|
||||
(when (or (eq? (hash-ref info 'khz #f) #f)
|
||||
(eq? (hash-ref info 'bits #f) #f))
|
||||
(let-values (((khz bits) (determine-flac-khz-and-bits path)))
|
||||
(hash-set! info 'khz khz)
|
||||
(hash-set! info 'bits bits)
|
||||
)
|
||||
(let-values (((khz bits) (determine-flac-khz-and-bits path)))
|
||||
(hash-set! info 'khz khz)
|
||||
(hash-set! info 'bits bits)
|
||||
)
|
||||
)
|
||||
(values base-path path info)
|
||||
@@ -254,7 +255,7 @@
|
||||
|
||||
;; Kopieer bestanden rechtstreeks indien nodig en geen flac
|
||||
(define (copy-other base-path path info)
|
||||
(when (and (needs-copying? info)
|
||||
(when (and (needs-copying? path info)
|
||||
(not (flac? path info)))
|
||||
(with-handlers ([exn? (λ (e)
|
||||
(set! failed-copies (+ failed-copies 1))
|
||||
@@ -275,7 +276,7 @@
|
||||
(let ((path-part (get-path-part info)))
|
||||
(unless (eq? path-part #f)
|
||||
(let ((rm-path (build-path opus-path
|
||||
(if (presumed-flac? path info)
|
||||
(if (presumed-flac? info)
|
||||
(path-replace-extension path-part #".opus")
|
||||
path-part))))
|
||||
(delete-directory/files rm-path #:must-exist? #f)
|
||||
@@ -371,7 +372,7 @@
|
||||
(sl-set-log-level log-level)
|
||||
|
||||
(let ((fw (make-file-admin music-path file-db-hash)))
|
||||
;; Enrichement phase
|
||||
;; Enrichment phase
|
||||
(set! fw (fw-add-step fw adjust-ext))
|
||||
(set! fw (fw-add-step fw flac-with-id3))
|
||||
(set! fw (fw-add-step fw flac-khz-bits))
|
||||
|
||||
Reference in New Issue
Block a user