Ugarit Manifest Maker
Check-in [6caa1bd9ec]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Sorted directories in the manifest maker, fixed a typo in a property name, and moved to using "mtime" rather than "dc:modified", to reflect that it is just a POSIX filesystem attribute rather than anything relating to the actual content, and keeping compatability as such with existing Ugarit conventions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6caa1bd9ecc26cf5bbbdf38ce5eb6d9730a3bae4
User & Date: alaric 2015-06-12 19:50:54
Context
2015-06-12
21:47
Preparation for release; tidying up and writing stub documentation. check-in: a9f8b21bcc user: alaric tags: trunk, 0.1
19:50
Sorted directories in the manifest maker, fixed a typo in a property name, and moved to using "mtime" rather than "dc:modified", to reflect that it is just a POSIX filesystem attribute rather than anything relating to the actual content, and keeping compatability as such with existing Ugarit conventions. check-in: 6caa1bd9ec user: alaric tags: trunk
2015-05-28
11:23
OGG metadata parsing, and -Dfoo="bar" for defaults. check-in: 65f90322e5 user: alaric tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ugarit-manifest-maker.scm.

263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
...
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
...
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
...
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
...
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
(define (get-mp3-metadata path)
  ;; http://id3.org/id3v2-00 / http://id3.org/id3v2.3.0
  (with-input-from-file path
    (lambda ()
      (let/cc
       abort*
       (let* ((metadata
               '((creator . #f)
                 (creation-date . #f)
                 (featuring . #f)
                 (collection-name . #f)
                 (collection-volume . #f)
                 (collection-volumes . #f)
                 (volume-index . #f)
                 (volume-size . #f)))
              (abort
               (lambda ()
                 (printf "   ;; Could not read metadata\n")
                 (abort* metadata)))
              (read-id3v22
               (lambda ()
                 (debug "Reading v2.2\n")
................................................................................
  ;; http://xiph.org/vorbis/doc/framing.html
  ;; http://xiph.org/vorbis/doc/v-comment.html
  (with-input-from-file path
    (lambda ()
      (let/cc
       abort*
       (let* ((metadata
               '((creator . #f)
                 (creation-date . #f)
                 (featuring . #f)
                 (collection-name . #f)
                 (collection-volume . #f)
                 (collection-volumes . #f)
                 (volume-index . #f)
                 (volume-size . #f)))
              (abort
               (lambda ()
                 (printf "   ;; Could not read metadata\n")
                 (abort* metadata))))
         ;; Skip header
         (read-ogg-page abort)
         ;; Read comment header
................................................................................
                      (comments comments))
             (if (null? comments)
                 md
                 (let ((key (car (car comments)))
                       (value (cdr (car comments))))
                   (cond
                    ((string-ci= key "artist")
                     (loop (alist-update! md 'cd:creator value)
                           (cdr comments)))
                    ((string-ci= key "performer")
                     (loop (alist-update! md 'dc:contributor value)
                           (cdr comments)))
                    ((string-ci= key "producer")
                     (loop (alist-update! md 'dc:contributor value)
                           (cdr comments)))
................................................................................
    (dc:source . #f)))

(define (generate-manifest path)
  (if (directory? path)
      ;; Recurse therein
      (for-each (lambda (relname)
                  (generate-manifest (make-pathname path relname)))
                (directory path))

      ;; Not a directory
      (when (included-file? path)
       (let* ((name (pathname-file path))
              (*got-name* #f)
              (print-item
               (lambda (item)
................................................................................
           (printf "  #;(description = \"\")\n")
           (printf "  ;; No metadata extraction available for ~S files"
                   (pathname-extension path))))

         (newline)

         (let ((stat (file-stat path)))
           (printf "  (dc:modified = ~S)\n" (vector-ref stat 8))
           (printf "  (ctime = ~S)\n" (vector-ref stat 7)))

         (let ((size (path-size path)))
           (printf "  (file-size = ~S))\n" size)
           (set! *total-bytes*
                 (+ *total-bytes* size))
           (set! *total-objects*







|
|
|
|
|
|
|
|







 







|
|
|
|
|
|
|
|







 







|







 







|







 







|







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
...
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
...
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
...
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
...
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
(define (get-mp3-metadata path)
  ;; http://id3.org/id3v2-00 / http://id3.org/id3v2.3.0
  (with-input-from-file path
    (lambda ()
      (let/cc
       abort*
       (let* ((metadata
               '((dc:creator . #f)
                 (dc:created . #f)
                 (dc:contributor . #f)
                 (set:title . #f)
                 (set:index . #f)
                 (set:size . #f)
                 (superset:index . #f)
                 (superset:size . #f)))
              (abort
               (lambda ()
                 (printf "   ;; Could not read metadata\n")
                 (abort* metadata)))
              (read-id3v22
               (lambda ()
                 (debug "Reading v2.2\n")
................................................................................
  ;; http://xiph.org/vorbis/doc/framing.html
  ;; http://xiph.org/vorbis/doc/v-comment.html
  (with-input-from-file path
    (lambda ()
      (let/cc
       abort*
       (let* ((metadata
               '((dc:creator . #f)
                 (dc:created . #f)
                 (dc:contributor . #f)
                 (set:title . #f)
                 (set:index . #f)
                 (set:size . #f)
                 (superset:index . #f)
                 (superset:size . #f)))
              (abort
               (lambda ()
                 (printf "   ;; Could not read metadata\n")
                 (abort* metadata))))
         ;; Skip header
         (read-ogg-page abort)
         ;; Read comment header
................................................................................
                      (comments comments))
             (if (null? comments)
                 md
                 (let ((key (car (car comments)))
                       (value (cdr (car comments))))
                   (cond
                    ((string-ci= key "artist")
                     (loop (alist-update! md 'dc:creator value)
                           (cdr comments)))
                    ((string-ci= key "performer")
                     (loop (alist-update! md 'dc:contributor value)
                           (cdr comments)))
                    ((string-ci= key "producer")
                     (loop (alist-update! md 'dc:contributor value)
                           (cdr comments)))
................................................................................
    (dc:source . #f)))

(define (generate-manifest path)
  (if (directory? path)
      ;; Recurse therein
      (for-each (lambda (relname)
                  (generate-manifest (make-pathname path relname)))
                (sort! (directory path) string<))

      ;; Not a directory
      (when (included-file? path)
       (let* ((name (pathname-file path))
              (*got-name* #f)
              (print-item
               (lambda (item)
................................................................................
           (printf "  #;(description = \"\")\n")
           (printf "  ;; No metadata extraction available for ~S files"
                   (pathname-extension path))))

         (newline)

         (let ((stat (file-stat path)))
           (printf "  (mtime = ~S)\n" (vector-ref stat 8))
           (printf "  (ctime = ~S)\n" (vector-ref stat 7)))

         (let ((size (path-size path)))
           (printf "  (file-size = ~S))\n" size)
           (set! *total-bytes*
                 (+ *total-bytes* size))
           (set! *total-objects*