annotate 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 |
rev |
line source |
j@236
|
1 (cl:in-package #:amuse-midi-db)
|
j@236
|
2
|
j@236
|
3 (defmethod list-collections ((package (eql *package*)) &key
|
j@236
|
4 compositions (stream *standard-output*))
|
j@236
|
5 "FIXME: better formatting."
|
j@236
|
6 (let ((collection-rows (%get-all-collection-headers)))
|
j@236
|
7 (flet ((print-separator (&optional (columns 77))
|
j@236
|
8 (format stream "~% ~A"
|
j@236
|
9 (make-sequence 'string columns :initial-element #\-))))
|
j@236
|
10 (loop for collection-row in collection-rows
|
j@236
|
11 do (destructuring-bind (collection-id collection-name description)
|
j@236
|
12 collection-row
|
j@236
|
13 (format stream "~%Collection-id: ~A~% Name: ~A~% Description: ~A~%"
|
j@236
|
14 collection-id collection-name description)
|
j@236
|
15 (when compositions
|
j@236
|
16 (list-compositions package
|
j@236
|
17 :collection-identifier
|
j@236
|
18 (make-midi-db-collection-identifier
|
j@236
|
19 collection-id))))
|
j@236
|
20 do (print-separator)))))
|
j@236
|
21
|
j@236
|
22 (defmethod list-compositions ((package (eql *package*)) &key
|
j@236
|
23 collection-identifier
|
j@236
|
24 (stream *standard-output*))
|
j@236
|
25 (let ((composition-headers
|
j@236
|
26 (if collection-identifier
|
j@236
|
27 (%get-all-collection-composition-headers
|
j@236
|
28 collection-identifier)
|
j@236
|
29 (%get-all-composition-headers))))
|
j@236
|
30 (loop for composition-header in composition-headers
|
j@236
|
31 do (destructuring-bind (collection-id filename timebase start
|
j@236
|
32 duration owner version
|
j@236
|
33 creation-timestamp
|
j@236
|
34 deletion-timestamp)
|
j@236
|
35 composition-header
|
j@236
|
36 (format stream "~%Collection-id: ~A filename: ~A timebase: ~A start: ~A duration: ~A owner: ~A version: ~A created: ~A deleted: ~A~%"
|
j@236
|
37 collection-id filename timebase start duration owner
|
j@236
|
38 version creation-timestamp deletion-timestamp)))))
|