private void tickShow() throws DocumentException {
String source = "";
try {
source = WGet.getSource(tvrageEplistUrl + show.getTvrageId());
} catch (Exception e) {
Episode ep = show.getNextEpisode();
ep.setEpisode(ep.getEpisode()+1);
return;
}
Document doc = DocumentHelper.parseText(source);
List<Element> nodes = doc.selectNodes("//episode");
boolean next = false;
for (Element episode : nodes) {
if (next) {
show.setNextEpisode(
new Episode(
Util.parseInt(episode.getParent().attributeValue("no"), -1)
, Util.parseInt(episode.elementText("seasonnum"), -1)));
new EpInfoSearcher(show).start();
return;
}
next = Util.parseInt(episode.getParent().attributeValue("no"), -1) == show.getNextEpisode().getSeason()
&& Util.parseInt(episode.elementText("seasonnum"), -1) == show.getNextEpisode().getEpisode();
}
show.setNextEpisode(new Episode(show.getNextEpisode().getSeason(), show.getNextEpisode().getEpisode() + 1, "Unknown"));
show.setNextAirDate(null);
WatchListController.showInfoCompleted(show);
}