lambda/src/index.js
/** Handles Apple Music - plays artist tracks or plays a radio station for the current track */
Handles Apple Music - plays artist tracks or plays a radio station for the current track
Handles Apple Music - plays artist tracks or plays a radio station for the current track
function moreMusicHandler(roomValue, service, cmdpath, response) {
    options.path = '/' + encodeURIComponent(roomValue) + '/state';
    httpreq(options, function (error, responseJson) {
        if (!error) {
            responseJson = JSON.parse(responseJson);
			console.log("Currently Playing = " + JSON.stringify(responseJson, null, 2));            
            if (responseJson.currentTrack.artist != undefined) {
           		var name = responseJson.currentTrack.artist;
            	if (cmdpath.startsWith('/station') && (['apple','spotify','deezer','elite'].indexOf(service) != -1)) {
                	name += ' ' + responseJson.currentTrack.title;
            	}    
	            musicHandler(roomValue, service, cmdpath, name, response);
	        } else {
            	response.tell("The current artist is not identified");
	        }
        } else { 
            genericResponse(error, response);
        }
    });
}
function moreMusicHandler ( roomValue , service , cmdpath , response ) { options . path = '/' + encodeURIComponent ( roomValue ) + '/state' ; httpreq ( options , function ( error , responseJson ) { if ( ! error ) { responseJson = JSON . parse ( responseJson ) ; console . log ( "Currently Playing = " + JSON . stringify ( responseJson , null , 2 ) ) ; if ( responseJson . currentTrack . artist != undefined ) { var name = responseJson . currentTrack . artist ; if ( cmdpath . startsWith ( '/station' ) && ( [ 'apple' , 'spotify' , 'deezer' , 'elite' ] . indexOf ( service ) != - 1 ) ) { name += ' ' + responseJson . currentTrack . title ; } musicHandler ( roomValue , service , cmdpath , name , response ) ; } else { response . tell ( "The current artist is not identified" ) ; } } else { genericResponse ( error , response ) ; } } ) ; }
Handles Apple Music - plays artist tracks or plays a radio station for the current track
Handles Apple Music - plays artist tracks or plays a radio station for the current track