File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ public func track_to_scm_record(track: RBSpotifyItem) -> SCM {
46
46
scm_from_int32 ( Int32 ( track. durationSeconds) ) ) // duration in seconds
47
47
}
48
48
49
+ @_cdecl ( " playlist_to_scm_record " )
50
+ public func playlist_to_scm_record( track: RBSpotifyItem ) -> SCM {
51
+ // Same caveats apply as with `track_to_scm_record`.
52
+ scm_call_2 ( scm_c_public_ref ( " spotiqueue records " , " make-playlist " ) ,
53
+ scm_from_utf8_string ( track. spotify_uri) , // uri
54
+ scm_from_utf8_string ( track. title) ) // title
55
+ }
56
+
49
57
@objc class RBGuileBridge : NSObject {
50
58
private static func call_hook( hook_name: String , args_list: SCM ) {
51
59
assert ( Thread . isMainThread)
Original file line number Diff line number Diff line change @@ -90,7 +90,11 @@ SCM get_tracks_from(NSArray* realTracks) {
90
90
SCM_UNDEFINED);
91
91
int32_t pos = 0 ;
92
92
for (RBSpotifyItem* t in realTracks) {
93
- scm_list_set_x (tracks, scm_from_int32 (pos), track_to_scm_record (t));
93
+ if ([t itemType ] == ItemTypePlaylist) {
94
+ scm_list_set_x (tracks, scm_from_int32 (pos), playlist_to_scm_record (t));
95
+ } else {
96
+ scm_list_set_x (tracks, scm_from_int32 (pos), track_to_scm_record (t));
97
+ }
94
98
pos++;
95
99
}
96
100
Original file line number Diff line number Diff line change 73
73
74
74
(define (just-the-uri-please item )
75
75
(cond ((track? item) (track-uri item))
76
+ ((playlist? item) (playlist-uri item))
76
77
((string? item) item)
77
78
(else #nil)))
78
79
Original file line number Diff line number Diff line change 32
32
(define (track-album track ) (_track-album track))
33
33
(define (track-duration track ) (_track-duration track))
34
34
35
+ ; ; A fledgling record type for playlists, so that we can support retrieving the contents of the
36
+ ; ; search pane, too.
37
+ (define-record-type <playlist>
38
+ (_make-playlist uri title)
39
+ _playlist?
40
+ (uri _playlist-uri)
41
+ (title _playlist-title))
42
+
43
+ (define (make-playlist uri title )
44
+ (_make-playlist uri title))
45
+
46
+ (define (playlist? playlist ) (_playlist? playlist))
47
+ (define (playlist-uri playlist ) (_playlist-uri playlist))
48
+ (define (playlist-title playlist ) (_playlist-title playlist))
49
+
35
50
; ;; END records.scm
You can’t perform that action at this time.
0 commit comments