public void release() { alive = false; synchronized (sync) { if (radioStationList != null) { radioStationList.cancel(); radioStationList = null; } } }
public String resolve(String[] newPath) { if (!alive) return null; String result; // first: try to resolve the stream url again (maybe something has changed) result = resolveStreamUrlFromM3uUrl(m3uUrl, null); if (!alive) return null; if (result != null) { if (newPath != null) newPath[0] = (new RadioStation(title, "", "", "", "", "", m3uUrl, false, isShoutcast)) .buildFullPath(result); return result; } // second: perform a new search for this radio station (this is the most time consuming // operation) synchronized (sync) { if (!alive) return null; radioStationList = (isShoutcast ? new ShoutcastRadioStationList("", "", "", "") : new IcecastRadioStationList("", "", "", "")); } final RadioStation radioStation = radioStationList.tryToFetchRadioStationAgain(Player.getService(), title); if (!alive) return null; if (radioStation != null) { result = resolveStreamUrlFromM3uUrl(radioStation.m3uUrl, null); if (result != null) { if (newPath != null) newPath[0] = radioStation.buildFullPath(result); return result; } } return null; }