developing
This commit is contained in:
52
playlist.rkt
52
playlist.rkt
@@ -56,20 +56,46 @@
|
||||
(define/public (image->file* to-file)
|
||||
#f)
|
||||
|
||||
(define/public (image->file to-file)
|
||||
(let ((tags (read-tags)))
|
||||
(if (tags-valid? tags)
|
||||
(let ((ext (tags-picture->ext tags)))
|
||||
(if (eq? ext #f)
|
||||
#f
|
||||
(let ((path (string-append to-file "." (symbol->string ext))))
|
||||
(if (tags-picture->file tags path)
|
||||
path
|
||||
#f)
|
||||
)
|
||||
)
|
||||
(define/public (image->file to-file*)
|
||||
(let ((to-file (format "~a" to-file*))
|
||||
(tags (read-tags)))
|
||||
(dbg-rktplayer "image->file ~a" to-file)
|
||||
(let ((image-from-tags (λ ()
|
||||
(if (tags-valid? tags)
|
||||
(let ((ext (tags-picture->ext tags)))
|
||||
(if (eq? ext #f)
|
||||
#f
|
||||
(let ((path (string-append to-file "." (symbol->string ext))))
|
||||
(if (tags-picture->file tags path)
|
||||
path
|
||||
#f)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f)))
|
||||
(let ((path (image-from-tags)))
|
||||
(dbg-rktplayer "image-from-tags: ~a" path)
|
||||
(if (eq? path #f)
|
||||
(let* ((bd (basedir file))
|
||||
(files (filter
|
||||
(λ (f)
|
||||
(let ((file (build-path bd f)))
|
||||
(file-exists? file)))
|
||||
(list "cover.jpg" "cover.png" "folder.jpg" "folder.png"))))
|
||||
(if (null? files)
|
||||
#f
|
||||
(let ((file (string-append to-file (bytes->string/utf-8 (path-get-extension (car files))))))
|
||||
(copy-file (build-path bd (car files)) file #:exists-ok? #t)
|
||||
(dbg-rktplayer "image from basedir: ~a" file)
|
||||
(format "~a" file))
|
||||
))
|
||||
path))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define/public (image->mimetype*)
|
||||
#f)
|
||||
|
||||
Reference in New Issue
Block a user