1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* parse specials from anidb episode data

This commit is contained in:
Reinhard Pointner 2013-05-06 08:21:20 +00:00
parent 011f4e82c0
commit fc1c8a26e2
3 changed files with 18 additions and 6 deletions

View File

@ -121,18 +121,22 @@ public class AnidbClient extends AbstractEpisodeListProvider {
List<Episode> episodes = new ArrayList<Episode>(25);
for (Node node : selectNodes("//episode", dom)) {
Integer number = getIntegerContent("epno", node);
Node epno = getChild("epno", node);
int number = Integer.parseInt(getTextContent(epno).replaceAll("\\D", ""));
int type = Integer.parseInt(getAttribute("type", epno));
// ignore special episodes
if (number != null) {
if (type == 1 || type == 2) {
Date airdate = Date.parse(getTextContent("airdate", node), "yyyy-MM-dd");
String title = selectString(".//title[@lang='" + language.getLanguage() + "']", node);
if (title.isEmpty()) { // English language fall-back
title = selectString(".//title[@lang='en']", node);
}
// no seasons for anime
episodes.add(new Episode(animeTitle, seriesStartDate, null, number, title, number, null, airdate));
if (type == 1) {
episodes.add(new Episode(animeTitle, seriesStartDate, null, number, title, number, null, airdate)); // normal episode, no seasons for anime
} else {
episodes.add(new Episode(animeTitle, seriesStartDate, null, null, title, null, number, airdate)); // special episode
}
}
}

View File

@ -54,7 +54,11 @@ public class EpisodeFormat extends Format {
}
} else {
// episode, but no season
sb.append(" - ").append(episodeNumber);
if (episode.getEpisode() != null) {
sb.append(" - ").append(episodeNumber);
} else if (includeSpecial && episode.getSpecial() != null) {
sb.append(" - ").append("Special " + episode.getSpecial());
}
}
sb.append(" - ").append(episode.getTitle());

View File

@ -60,6 +60,10 @@ public final class EpisodeUtilities {
if (diff != 0)
return diff;
diff = compareValue(a.getSpecial(), b.getSpecial());
if (diff != 0)
return diff;
return compareValue(a.getTitle(), b.getTitle());
}