Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func fetchAlbumSongs(albumID: String, completion: @escaping ([SongData]) -> Void) {
- // Fetch the recommended album's songs and add them to the song queue.
- var songs: [SongData] = []
- let param = ["": ""]
- APIClient.sharedInstance.MakeAPICallWithAuthHeaderGet(Constants.APIServices.GET_DISCOVER_ALBUMS_SONG.rawValue + albumID + "/tracks", parameters: param) { (response, error, statusCode) in
- if error == nil {
- if statusCode == 200 {
- if let response = response {
- if let arrData = response.value(forKey: "data") as? NSArray {
- for album in arrData {
- let discovery = DiscoveryModel(fromDictionary: (album as? NSDictionary)!)
- print("fetchAlbumSongs in Autoplay: \(discovery.relationships.tracksData.tracks)")
- songs.append(contentsOf: discovery.relationships.tracksData.tracks)
- }
- completion(songs);
- }
- }
- }
- }
- else {
- print("Autoplay: Error fetchAlbumSongs: \(error?.localizedDescription)")
- }
- }
- completion([]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement