aboutsummaryrefslogtreecommitdiffhomepage
path: root/vampire.lisp
blob: 7ad9b636f4e2678960a8b009a9e86ca7e3ed1d37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;;;; vampire.lisp

(in-package #:vampire)

;;; SYSTEM CONFIG COMPONENT

(defvar *config* nil)

(defclass/std config ()
  ((datastore-directory :ir
    :std #P"/srv/parasite/store/")
   (port :ir
    :std 4919)
   (media-directory :ir
    :std #P"/srv/parasite/media/")))

;;; RESOURCE MODEL

(defclass/bknr keyed ()
  ((key
    :r :std (nuid)
    :index-type string-unique-index
    :index-reader object-with-key)))

(defclass/bknr content (keyed)
  ((title :with :std "")
   (user :with
    :ri
    :std (error "A USER is required to have created the content.")
    :index-type hash-index
    :index-reader content-by-user)))

(defmethod initialize-instance :after ((content content) &key)
  (when (zerop (length (content-title content)))
    (setf (content-title content) (format nil "~a-~a"
                                          (class-of content)
                                          (store-object-id content)))))

(defclass/bknr playlist (content)
  ((tracks editors :with :std (list))))

(defclass/bknr track (content)
  ((source media artist album :with)
   (playlists :with :std (list) :doc "Playlists in which this track appears.")
   (status :a :with
           :std :uninitialized
           :doc ":uninitialized, :acquiring, :available, :error-aquiring")))

(defclass/bknr user (keyed)
  ((name :with :std "")
   (pw pwhash :with )
   (playlists :with :std (list) :doc "Playlists made by this user")))

(defclass/std media (bknr.datastore:blob)
  ((track :with))
  (:metaclass persistent-class))

;;; RESOURCE ACCESS PROTOCOL