blob: 0e29c734c3868d0c580643c4be819ff09fecf546 (
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
|
(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))
(defun steam-games-uri ()
(quri:render-uri
(quri:make-uri-http
:host steam-host
:path "IPlayerService/GetOwnedGames/v0001/"
:query (quri:url-encode-params `(("key" . ,(steam-key *config*))
("steamid" . ,(steam-user-id *config*))
("include_appinfo" . "true"))))))
(defun steam-games ()
(cadadr
(json:parse
(flexi-streams:octets-to-string
(drakma:http-request (steam-games-uri))))))
(defun make-steam-game (json)
(with-plist ((id :|appid|) (playtime :|playtime_forever|) (name :|name|)
(icon-url :|img_icon_url|) (last-played :|rtime_last_played|))
json
(let ((game (make-instance 'steam-game :name name :appid id)))
(setf (playtime game) playtime
(icon-url game) icon-url
(last-played game) last-played)
game)))
|