Przeglądaj źródła

documentation, cleanup, etc

Mark VandenBrink 12 lat temu
rodzic
commit
85c9d7a54f
3 zmienionych plików z 33 dodań i 7 usunięć
  1. 7 4
      README.md
  2. 1 1
      packages.lisp
  3. 25 2
      taglib-tests.lisp

+ 7 - 4
README.md

@@ -25,6 +25,10 @@ Notes II:
   I get problems. 
 * I've run this tool across my 19,000+ audio collection and compared the results to some of the tools above, with little to no variations.
   That said, I have a pretty uniform collection, mostly from ripping CDs, then iTunes purchases/matched, and the Amazon matched. YMMV
+* Parsing the audio info in an MP3 is hideously inefficient and needs a rewrite (mpeg.lisp). There is a global parameter in audio-streams.lisp
+  called *get-audio-info* that controls whether parse-mp4-file/parse-mp3-file try to extract this info.  To speed things up,
+  you can bind this this parameter to nil (eg: (let ((audio-streams:*get-audio-info* nil)) (parse-...)).  As an example, when we're 
+  not getting audio-info, parsing an MP3 takes microsends.  When we are, it takes seconds.
 
 And now for some sample invocations and outputs:
 
@@ -81,9 +85,8 @@ Header: version/revision: 3/0, flags: 0x00: 0/0/0/0, size = 11,899 bytes; No ext
         frame-txxx: flags: 0x0000: 0/0/0/0/0/0, offset: 136, version = 3, id: TXXX, len: 33, NIL, <Tagging time/2013-08-08T16:38:38>
 ```
 
-I also have a semi-complete logging strategy in place.  Logging is based on the LOG5 package.
-
-To see the output of ALL logging statements to *STANDARD-OUTPUT*, you can do the following:
+I have a semi-complete logging strategy in place that is primarily used to figure out what happened when I get
+an unexpected error parsing a file. To see the output of ALL logging statements to *STANDARD-OUTPUT*, you can do the following:
 
 ```
 (with-logging ()
@@ -106,5 +109,5 @@ If you *really* want to create a lot of output, you can do the following:
     (redirect "q.txt" (test2 :dir "somewhere-where-you-have-all-your-audio" :raw t)))
 ```
 
-For my 19,000+ files, this generates XXX lines in "log.txt" and XXX lines in "q.txt".  It also took YYY minutes, YYY seconds (again, over CIFS and/or NFS).
+For my 19,000+ files, this generates 218,788,792 lines in "log.txt" and 240,727 lines in "q.txt".
 

+ 1 - 1
packages.lisp

@@ -11,7 +11,7 @@
   (:use #:common-lisp))
 
 (defpackage #:audio-streams
-  (:export #:octets #:make-octets *get-mpeg-audio-info*
+  (:export #:octets #:make-octets *get-audio-info*
            #:mp3-file-stream #:mp4-file-stream #:base-mem-stream
            #:id3-header #:audio-info #:mp4-atoms
            #:parse-mp3-file #:parse-mp4-file

+ 25 - 2
taglib-tests.lisp

@@ -7,8 +7,9 @@
 
 (in-package #:taglib-tests)
 
-(defparameter *song-m4a* "01 Keep Yourself Alive.m4a"     "handy filename to test MP4s")
-(defparameter *song-mp3* "02 You Take My Breath Away.mp3" "handy filename to test MP3s")
+;;; some convenient songs to parse
+(defparameter *song-m4a* "Queen/Queen 01 Keep Yourself Alive.m4a")
+(defparameter *song-mp3* "Queen/Sheer Heart Attack/07 In The Lap Of The Gods.mp3")
 
 ;;;
 ;;; Set the pathname (aka filename) encoding in CCL for appropriate platorm
@@ -103,3 +104,25 @@ to see if it matches. PATHNAME version."
                                         (let ((file (mp4-test0 full-name)))
                                           (when file
                                             (mp4-tag:show-tags file :raw raw)))))))))
+
+(defun time-test (dir &key (file-system-encoding :utf-8) (do-audio-processing t))
+  "Time parsing of DIR."
+  (let ((mp3-count 0)
+        (mp4-count 0)
+        (other-count 0))
+    (labels ((do-dir (dir)
+               (osicat:walk-directory dir (lambda (f)
+                                            (let ((full-name (merge-pathnames (ccl:current-directory) (pathname f))))
+                                              (cond ((has-extension f "mp3")
+                                                     (incf mp3-count)
+                                                     (mp3-test0 full-name))
+                                                    ((has-extension f "m4a")
+                                                     (incf mp4-count)
+                                                     (mp4-test0 full-name))
+                                                    (t
+                                                     (incf other-count))))))))
+      (set-pathname-encoding file-system-encoding)
+      (let ((audio-streams:*get-audio-info* do-audio-processing))
+        (time (do-dir dir)))
+      (format t "~:d MP3s, ~:d MP4s, ~:d Others~%"
+              mp3-count mp4-count other-count))))