annotate base/datasets/datasets-file/methods.lisp @ 251:6a3adca16910
Refactor dataset stuff out of amuse-database-admin, and add midifile-dataset.
author |
Jamie Forth <j.forth@gold.ac.uk> |
date |
Thu, 24 Feb 2011 11:23:18 +0000 |
parents |
|
children |
|
rev |
line source |
j@251
|
1 (cl:in-package #:amuse-datasets)
|
j@251
|
2
|
j@251
|
3 (defmethod make-dataset ((identifier midifile-dataset-identifier)
|
j@251
|
4 composition-identifiers &optional
|
j@251
|
5 description)
|
j@251
|
6 (make-instance 'midifile-dataset
|
j@251
|
7 :%data composition-identifiers
|
j@251
|
8 :identifier identifier
|
j@251
|
9 :description description))
|
j@251
|
10
|
j@251
|
11 (defmethod get-dataset ((dataset-identifier midifile-dataset-identifier))
|
j@251
|
12 (let ((midifile-paths
|
j@251
|
13 (append (directory (merge-pathnames (dataset-path
|
j@251
|
14 dataset-identifier) "*.mid*"))
|
j@251
|
15 (directory (merge-pathnames (dataset-path
|
j@251
|
16 dataset-identifier) "*.MID*")))))
|
j@251
|
17 (unless midifile-paths
|
j@251
|
18 (warn "No midifiles in: ~A" (dataset-path dataset-identifier))
|
j@251
|
19 (return-from get-dataset nil))
|
j@251
|
20 (loop for path in midifile-paths
|
j@251
|
21 collect (make-composition-identifier
|
j@251
|
22 (implementation-package dataset-identifier) path)
|
j@251
|
23 into composition-identifiers
|
j@251
|
24 finally (return (make-dataset dataset-identifier
|
j@251
|
25 composition-identifiers)))))
|
j@251
|
26
|
j@251
|
27
|