/** * Request the next track from the trackmanager and play it. When a 404 is returned, delete this * show. On any other error: log it and try again in 0.5s. */ private void play_next_track() { try { last_action = "get next track"; current_track = new JSONObject(get_url(pop_url)); WMSLoggerFactory.getLogger(null).info(current_path() + " on " + id); boolean success = stream.play("mp3:" + current_path(), 0, -1, true); pop_error = false; last_action = "play " + current_path(); if (!success) { last_action = "failed play " + current_path(); schedule_play_next_track(); } } catch (Callback404Exception e) { last_action = "remove show"; Shows.remove_show(app.getName(), id); return; } catch (IOException e) { // streamer offline? WMSLoggerFactory.getLogger(null) .error("streamer unreachable (IOException in get_url) in " + id); WMSLoggerFactory.getLogger(null).error("asdf", e); pop_error = true; wait(500); schedule_play_next_track(); } catch (Exception e) { WMSLoggerFactory.getLogger(null).error("Unexpected exception in " + id, e); pop_error = true; wait(500); schedule_play_next_track(); } }