-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrecords.scm
50 lines (41 loc) · 1.66 KB
/
records.scm
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
;;; BEGIN records.scm
;;;
;;; Copyright © 2021 paul at denknerd dot org
;;;
;;; This file contains definitions of record types that are useful to users. For example, when you
;;; subscribe to hooks, some of them will pass you a <track> object.
(define-module (spotiqueue records)
#:use-module (srfi srfi-9))
(module-export-all! (current-module))
(format #t "guile ~s: Loading Spotiqueue record definitions...~%" (module-name (current-module)))
;; Define a track representation for callbacks
(define-record-type <track>
(_make-track uri title artist album duration)
_track?
(uri _track-uri)
(title _track-title)
(artist _track-artist)
(album _track-album)
(duration _track-duration))
;; OMG, we have these because you can't eval a syntax transformer from C??
(define (make-track uri title artist album duration)
(_make-track uri title artist album duration))
(define (track? track) (_track? track))
(define (track-uri track) (_track-uri track))
(define (track-title track) (_track-title track))
(define (track-artist track) (_track-artist track))
(define (track-album track) (_track-album track))
(define (track-duration track) (_track-duration track))
;; A fledgling record type for playlists, so that we can support retrieving the contents of the
;; search pane, too.
(define-record-type <playlist>
(_make-playlist uri title)
_playlist?
(uri _playlist-uri)
(title _playlist-title))
(define (make-playlist uri title)
(_make-playlist uri title))
(define (playlist? playlist) (_playlist? playlist))
(define (playlist-uri playlist) (_playlist-uri playlist))
(define (playlist-title playlist) (_playlist-title playlist))
;;; END records.scm