if(criteria.contains(":") && !criteria.startsWith(MenuLevelFolder.TYPE+":") && !criteria.startsWith(MenuLevelImageFolder.TYPE+":")) {
currentId = criteria;
}
}
TrackEntity entity = null;
if (criteriaList.size() == 1 && currentId.startsWith("Track:")) {
BrowseService browseService = browseServiceManager.getBrowseService("Track");
if (browseService != null) {
ResultItem currentItem = browseService.findById(currentId.substring(currentId.indexOf(":") + 1));
entity = (TrackEntity) currentItem.getItem();
}
}
Result<SpotifyTrack> result = new Result<SpotifyTrack>();
if (entity != null) {
try {
JSONObject object = Client.create().resource("http://ws.spotify.com/search/1/track.json?q=track:" + URLEncoder.encode(entity.getRecording().getWorks().iterator().next().getName(), "utf8")).accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
result.setCount(object.getJSONObject("info").getInt("num_results"));
List<ResultItem<SpotifyTrack>> tracks = new ArrayList<ResultItem<SpotifyTrack>>();
JSONArray array = object.getJSONArray("tracks");
result.setCount(array.length());
for (int i = 0; i < array.length(); i++) {