small bug fixes
This commit is contained in:
+29
-22
@@ -18,7 +18,7 @@
|
|||||||
(define (audio-manager music-path opus-path #:log-level [log-level 'debug])
|
(define (audio-manager music-path opus-path #:log-level [log-level 'debug])
|
||||||
(let* ((ini-config-file (build-path music-path ".audio-manager.ini"))
|
(let* ((ini-config-file (build-path music-path ".audio-manager.ini"))
|
||||||
(ini (file->ini ini-config-file))
|
(ini (file->ini ini-config-file))
|
||||||
(mail-oke (check-mail-config))
|
(mail-oke (check-mail-config ini))
|
||||||
(report-flacs-with-id3 "FLAC files with id3 tags\n\n")
|
(report-flacs-with-id3 "FLAC files with id3 tags\n\n")
|
||||||
(report-flac "")
|
(report-flac "")
|
||||||
(report-opus "")
|
(report-opus "")
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
(processed-kind (make-hash))
|
(processed-kind (make-hash))
|
||||||
(base-rate (ini-get ini 'flac 'max-khz 48000))
|
(base-rate (ini-get ini 'flac 'max-khz 48000))
|
||||||
(dirs-logged -1)
|
(dirs-logged -1)
|
||||||
(known-audio-exts '(mp3 flac opus mp4 mp4a mpg ape wav))
|
(known-audio-exts '(mp3 flac opus mp4 m4a mpg ape wav))
|
||||||
(known-exts (append known-audio-exts
|
(known-exts (append known-audio-exts
|
||||||
'(jpg jpeg png pdf)))
|
'(jpg jpeg png pdf)))
|
||||||
(unknown-exts '())
|
(unknown-exts '())
|
||||||
@@ -60,12 +60,22 @@
|
|||||||
(eq? state 'new)))))
|
(eq? state 'new)))))
|
||||||
|
|
||||||
(define (needs-copying? info)
|
(define (needs-copying? info)
|
||||||
(and (eq? (hash-ref info 'type #f) 'file)
|
(let ((state (hash-ref info 'file-db #f)))
|
||||||
(not (eq? (hash-ref info 'file-db #f) 'deleted))
|
(and (eq? (hash-ref info 'type #f) 'file)
|
||||||
(let ((path-part (get-path-part info)))
|
(not (eq? state 'deleted))
|
||||||
(if (eq? path-part #f)
|
(not-hidden? path)
|
||||||
#f
|
(let ((path-part (get-path-part info)))
|
||||||
(not (file-exists? (build-path opus-path path-part)))))))
|
(if (eq? path-part #f)
|
||||||
|
#f
|
||||||
|
(if (and (eq? state 'unchanged)
|
||||||
|
(file-exists? (build-path opus-path path-part)))
|
||||||
|
#f
|
||||||
|
#t)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(define (deleted? info)
|
(define (deleted? info)
|
||||||
(eq? (hash-ref info 'file-db #f) 'deleted))
|
(eq? (hash-ref info 'file-db #f) 'deleted))
|
||||||
@@ -84,18 +94,17 @@
|
|||||||
(eq? (hash-ref info 'ext) 'flac)
|
(eq? (hash-ref info 'ext) 'flac)
|
||||||
(eq? (hash-ref info 'sniffed #f) 'mp3)))
|
(eq? (hash-ref info 'sniffed #f) 'mp3)))
|
||||||
|
|
||||||
|
(define (presumed-flac? info)
|
||||||
|
(and (eq? (hash-ref info 'type) 'file)
|
||||||
|
(eq? (hash-ref info 'ext) 'flac)))
|
||||||
|
|
||||||
(define (flac? path info)
|
(define (flac? path info)
|
||||||
(when (eq? (hash-ref info 'type) 'file)
|
(when (presumed-flac? info)
|
||||||
(let ((s (hash-ref info 'sniffed #f)))
|
(let ((s (hash-ref info 'sniffed #f)))
|
||||||
(when (eq? s #f)
|
(when (eq? s #f)
|
||||||
(hash-set! info 'sniffed (audio-sniff-format path))
|
(set! s (audio-sniff-format path))
|
||||||
)))
|
(hash-set! info 'sniffed s))
|
||||||
(and
|
(eq? s 'flac))))
|
||||||
(eq? (hash-ref info 'type) 'file)
|
|
||||||
(eq? (hash-ref info 'ext) 'flac)
|
|
||||||
(eq? (hash-ref info 'sniffed) 'flac)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(define (rep-id3 path)
|
(define (rep-id3 path)
|
||||||
(set! report-flacs-with-id3
|
(set! report-flacs-with-id3
|
||||||
@@ -117,7 +126,7 @@
|
|||||||
(hash-set! info 'orig-ext ext)
|
(hash-set! info 'orig-ext ext)
|
||||||
(unless (eq? ext '||)
|
(unless (eq? ext '||)
|
||||||
(unless (memq ext known-exts)
|
(unless (memq ext known-exts)
|
||||||
(hash-set! info 'ext 'unkown)
|
(hash-set! info 'ext 'unknown)
|
||||||
(unless (memq ext unknown-exts)
|
(unless (memq ext unknown-exts)
|
||||||
(set! unknown-exts (sort (cons ext unknown-exts)
|
(set! unknown-exts (sort (cons ext unknown-exts)
|
||||||
kinds<))
|
kinds<))
|
||||||
@@ -266,10 +275,8 @@
|
|||||||
(let ((path-part (get-path-part info)))
|
(let ((path-part (get-path-part info)))
|
||||||
(unless (eq? path-part #f)
|
(unless (eq? path-part #f)
|
||||||
(let ((rm-path (build-path opus-path
|
(let ((rm-path (build-path opus-path
|
||||||
(if (flac? path info)
|
(if (presumed-flac? path info)
|
||||||
(path-replace-extension
|
(path-replace-extension path-part #".opus")
|
||||||
(build-path opus-path path-part)
|
|
||||||
#".opus")
|
|
||||||
path-part))))
|
path-part))))
|
||||||
(delete-directory/files rm-path #:must-exist? #f)
|
(delete-directory/files rm-path #:must-exist? #f)
|
||||||
(let ((normalized-sub-path (hash-ref info 'path)))
|
(let ((normalized-sub-path (hash-ref info 'path)))
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
(define scribblings '(("scribblings/audio-library-manager.scrbl" ())))
|
(define scribblings '(("scribblings/audio-library-manager.scrbl" ())))
|
||||||
(define build-deps '("rackunit-lib" "scribble-lib" "racket-doc"))
|
(define build-deps '("rackunit-lib" "scribble-lib" "racket-doc"))
|
||||||
(define pkg-desc "Audio library maintenance tools for FLAC and Opus trees")
|
(define pkg-desc "Audio library maintenance tools for FLAC and Opus trees")
|
||||||
(define version "0.2.2")
|
(define version "0.2.4")
|
||||||
(define pkg-authors '(hans-dijkema))
|
(define pkg-authors '(hans-dijkema))
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(define (mail-report ini subject report)
|
(define (mail-report ini subject report)
|
||||||
(let-values (((from to server port user auth) (get-config ini)))
|
(let-values (((from to server port user passwd) (get-config ini)))
|
||||||
(let* ((hdr (standard-message-header from (list to) '() '() subject)))
|
(let* ((hdr (standard-message-header from (list to) '() '() subject)))
|
||||||
(smtp-send-message server from (list to) hdr
|
(smtp-send-message server from (list to) hdr
|
||||||
(if (list? report) report (list report))
|
(if (list? report) report (list report))
|
||||||
|
|||||||
Reference in New Issue
Block a user