diff options
Diffstat (limited to 'steam.lisp')
-rw-r--r-- | steam.lisp | 42 |
1 files changed, 31 insertions, 11 deletions
@@ -6,17 +6,37 @@ (defun set-steam-id (id) (setf (steam-user-id *config*) id)) -(defun steam-query-key () - (format nil "key=~a" (steam-key *config*))) - -(defun steam-query-user () - (format nil "steamid=~a" (steam-user-id *config*))) - (defun steam-games-uri () - (quri:make-uri-http - :host steam-host - :path "IPlayerService/GetOwnedGames/v0001/" - :query (format nil "~a&~a" (steam-query-key) (steam-query-user)))) + (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 () - (drakma:http-request (quri:render-uri (steam-games-uri)))) + (cadadr + (json:parse + (flexi-streams:octets-to-string + (drakma:http-request (steam-games-uri)))))) + +;; (:|rtime_last_played| 1674604954 +;; :|playtime_linux_forever| 15 +;; :|playtime_mac_forever| 0 +;; :|playtime_windows_forever| 0 +;; :|has_community_visible_stats| T +;; :|img_icon_url| "560d02f1edb9bf8a40060ff1c8cf818332cc2c9a" +;; :|playtime_forever| 15 +;; :|name| "Amazing Cultivation Simulator" +;; :|appid| 955900) + +(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))) |