This commit is contained in:
2026-02-24 23:28:18 +01:00
parent 8fb7cca9c2
commit 177829ccb6
4 changed files with 90 additions and 23 deletions

View File

@@ -41,16 +41,40 @@
(super-new)
(begin
(unless (eq? file #f)
(let ((tags (id3-tags (format "~a" file))))
(set! title (tags-title tags))
(set! artist (tags-artist tags))
(set! album (tags-album tags))
(set! number (tags-track tags))
(set! length (tags-length tags))
(let ((f (if (path? file) (path->string file) file)))
(let ((tags (id3-tags f))
(tmpfile #f))
(unless (tags-valid? tags)
(the-displayln "Invalid, try to open a copy of this file")
(let ((nfile (make-temporary-file "rktplayer-~a" #:copy-from f)))
(set! tags (id3-tags nfile))
(set! tmpfile nfile)
)
)
(if (tags-valid? tags)
(begin
(set! title (tags-title tags))
(set! artist (tags-artist tags))
(set! album (tags-album tags))
(set! number (tags-track tags))
(set! length (tags-length tags))
)
(begin
(set! title "invalid tags")
(set! artist "invalid tags")
(set! album "invalid tags")
(set! number number)
(set! length -1)
)
)
(unless (eq? tmpfile #f)
(delete-file tmpfile))
)
)
)
)
))
)
)
(define list-len length)
@@ -85,6 +109,7 @@
(if (directory-exists? p)
(read-tracks-internal p)
(when (and (file-exists? p) (can-add? p))
;(displayln (format "Adding ~a" p))
(add-track* p)))))
content))
'no-file-or-dir