public List < Track > searchTracks ( String q , String q_artist , String q_track , int page , int pageSize , boolean f_has_lyrics ) throws MusixMatchException { List < Track > trackList = null ; TrackSeachMessage message = null ; Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( Constants . API_KEY , apiKey ) ; params . put ( Constants . QUERY , q ) ; params . put ( Constants . QUERY_ARTIST , q_artist ) ; params . put ( Constants . QUERY_TRACK , q_track ) ; params . put ( Constants . PAGE , page ) ; params . put ( Constants . PAGE_SIZE , pageSize ) ; if ( f_has_lyrics ) { params . put ( Constants . F_HAS_LYRICS , "1" ) ; } else { params . put ( Constants . F_HAS_LYRICS , "0" ) ; } String response = null ; response = MusixMatchRequest . sendRequest ( Helper . getURLString ( Methods . TRACK_SEARCH , params ) ) ; Gson gson = new Gson ( ) ; try { message = gson . fromJson ( response , TrackSeachMessage . class ) ; } catch ( JsonParseException jpe ) { handleErrorResponse ( response ) ; } int statusCode = message . getTrackMessage ( ) . getHeader ( ) . getStatusCode ( ) ; if ( statusCode > 200 ) { throw new MusixMatchException ( "Status Code is not 200" ) ; } trackList = message . getTrackMessage ( ) . getBody ( ) . getTrack_list ( ) ; return trackList ; }
Search tracks using the given criteria .