comparison implementations/midi-db/methods.lisp @ 236:a5d065905f6d

Add midi-db. Ignore-this: c6f4fc32efa4453ddbdc478793eedd52 A basic implementation for working with MIDI files stored in the database. It is a test case for `versioned' data, but only partially implemented at the moment. darcs-hash:20100223152703-16a00-4388d2720907d777a1c6c6b3a010885ce0fe06a7.gz committer: Jamie Forth <j.forth@gold.ac.uk>
author j.forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 11:23:18 +0000
parents
children c454b4fc9aad
comparison
equal deleted inserted replaced
235:ea45a3d0730c 236:a5d065905f6d
1 (cl:in-package #:amuse-midi-db)
2
3 (defmethod list-collections ((package (eql *package*)) &key
4 compositions (stream *standard-output*))
5 "FIXME: better formatting."
6 (let ((collection-rows (%get-all-collection-headers)))
7 (flet ((print-separator (&optional (columns 77))
8 (format stream "~% ~A"
9 (make-sequence 'string columns :initial-element #\-))))
10 (loop for collection-row in collection-rows
11 do (destructuring-bind (collection-id collection-name description)
12 collection-row
13 (format stream "~%Collection-id: ~A~% Name: ~A~% Description: ~A~%"
14 collection-id collection-name description)
15 (when compositions
16 (list-compositions package
17 :collection-identifier
18 (make-midi-db-collection-identifier
19 collection-id))))
20 do (print-separator)))))
21
22 (defmethod list-compositions ((package (eql *package*)) &key
23 collection-identifier
24 (stream *standard-output*))
25 (let ((composition-headers
26 (if collection-identifier
27 (%get-all-collection-composition-headers
28 collection-identifier)
29 (%get-all-composition-headers))))
30 (loop for composition-header in composition-headers
31 do (destructuring-bind (collection-id filename timebase start
32 duration owner version
33 creation-timestamp
34 deletion-timestamp)
35 composition-header
36 (format stream "~%Collection-id: ~A filename: ~A timebase: ~A start: ~A duration: ~A owner: ~A version: ~A created: ~A deleted: ~A~%"
37 collection-id filename timebase start duration owner
38 version creation-timestamp deletion-timestamp)))))