You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
975 B
37 lines
975 B
(in-package #:lolicore)
|
|
|
|
(defmacro make-ratings ((safe questionable explicit))
|
|
`(quote (("s" . ,safe)
|
|
("q" . ,questionable)
|
|
("e" . ,explicit))))
|
|
|
|
(defvar ratings-full-words '(("s" . "safe")
|
|
("q" . "questionable")
|
|
("e" . "explicit")))
|
|
|
|
(defclass booru ()
|
|
((name
|
|
:initarg :name
|
|
:reader :name)
|
|
(url
|
|
:initarg :url
|
|
:reader url)
|
|
(rating-table
|
|
:initarg :rating-table
|
|
:reader rating-table)
|
|
(rating-posts
|
|
:initarg :rating-posts
|
|
:reader rating-posts))
|
|
(:default-initargs
|
|
:url (error "Need a URL")
|
|
:rating-table '(("s" . "s")
|
|
("q" . "q")
|
|
("e" . "e"))
|
|
:rating-posts (error "Need number of posts per rating")))
|
|
|
|
(defmethod get-rating ((obj booru) rating)
|
|
(cdr (assoc rating (rating-table obj) :test 'string=)))
|
|
|
|
(defmethod get-posts ((obj booru) rating)
|
|
(cdr (assoc rating (rating-posts obj) :test 'string=)))
|