summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshoshin <shoshin@cicadas.surf>2023-04-14 22:07:37 -0500
committershoshin <shoshin@cicadas.surf>2023-04-14 22:07:37 -0500
commiteff95690dbb1200bd66c730bc1aef6b686d13ec3 (patch)
tree62f2f3b836c78ea29dccc9be8ea7ba567f7b5dae
parent21b58059a35527cb59a02f2748bb71341443274e (diff)
Clean: some docstrings, new print-object method
-rw-r--r--model.lisp27
-rw-r--r--steam.lisp10
2 files changed, 19 insertions, 18 deletions
diff --git a/model.lisp b/model.lisp
index 3f0e4a1..7c863aa 100644
--- a/model.lisp
+++ b/model.lisp
@@ -7,26 +7,31 @@
(games :accessor games)))
(defclass game (db:store-object)
- ((name :initarg :name :reader name
- :index-type idx:string-unique-index
- :index-reader game-with-name
- :index-values all-games)
+ ((name
+ :initarg :name
+ :reader name
+ :index-type idx:string-unique-index
+ :index-reader game-with-name
+ :index-values all-games)
(rating :accessor rating)
(playtime :accessor playtime)
(icon-url :accessor icon-url)
(last-played :accessor last-played))
(:metaclass db:persistent-class))
+(defmethod print-object ((object game) stream)
+ (print-unreadable-object (object stream :type t :identity t)
+ (princ (name object) stream)))
+
(defclass steam-game (game)
- ((appid :initarg :appid :reader appid
- :index-type idx:unique-index
- :index-initargs (:test #'equal)
- :index-reader steam-game-with-appid))
+ ((appid
+ :initarg :appid
+ :reader appid
+ :index-type idx:unique-index
+ :index-initargs (:test #'equal)
+ :index-reader steam-game-with-appid))
(:metaclass db:persistent-class))
-(defmethod print-object ((object steam-game) stream)
- (format stream "#<STEAM GAME ~a>" (name object)))
-
(defclass feat (db:store-object)
((game
:reader game
diff --git a/steam.lisp b/steam.lisp
index 5bc49a8..f8fa64c 100644
--- a/steam.lisp
+++ b/steam.lisp
@@ -2,12 +2,6 @@
(defvar steam-host "api.steampowered.com")
-(defun set-steam-key (key)
- (setf (steam-key *config*) key))
-
-(defun set-steam-id (id)
- (setf (steam-user-id *config*) id))
-
;; JSON
;; * The API returns an object containing the named object with the result data.
;; * Arrays are represented as an array with the name of the type of the objects
@@ -122,13 +116,15 @@ game
rec)))))
(defun load-steam-games ()
- "Fetch and wrap STEAM-GAMES as persistent objects.
+ "Fetch and wrap STEAM-GAMEs as persistent objects.
WARNING! Not idempotent!"
(db:with-transaction ()
(loop for data in (fetch-steam-games)
do (make-steam-game data))))
(defun load-achievement-data (game)
+ "Fetch and wrap STEAM-ACHIEVEMENTs as persistent objects.
+WARNING! Not idempotent!"
(loop for schema in (fetch-steam-game-schema game)
for achievements in (fetch-steam-achievements game)
do (make-steam-achievement game schema achievements)))