* don't query unused attributes for performance reasons

This commit is contained in:
Reinhard Pointner 2008-06-02 22:17:58 +00:00
parent ff90a3f0df
commit 89e5310ec6
2 changed files with 3 additions and 19 deletions

View File

@ -76,7 +76,7 @@ public class SubsceneSubtitleClient extends SubtitleClient {
List<Node> nodes = XPathUtil.selectNodes("//TABLE[@class='filmSubtitleList']//A[@id]//ancestor::TR", dom);
ArrayList<SubsceneSubtitleDescriptor> list = new ArrayList<SubsceneSubtitleDescriptor>();
List<SubsceneSubtitleDescriptor> list = new ArrayList<SubsceneSubtitleDescriptor>();
for (Node node : nodes) {
try {
@ -87,8 +87,6 @@ public class SubsceneSubtitleClient extends SubtitleClient {
String lang = XPathUtil.selectString("./SPAN[1]", linkNode);
String name = XPathUtil.selectString("./SPAN[2]", linkNode);
int numberOfCDs = Integer.parseInt(XPathUtil.selectString("./TD[2]", node));
boolean hearingImpaired = (XPathUtil.selectFirstNode("./TD[3]/*[@id='imgEar']", node) != null);
String author = XPathUtil.selectString("./TD[4]", node);
Matcher matcher = hrefPattern.matcher(href);
@ -101,7 +99,7 @@ public class SubsceneSubtitleClient extends SubtitleClient {
URL downloadUrl = getDownloadUrl(url, subtitleId, typeId);
list.add(new SubsceneSubtitleDescriptor(name, lang, numberOfCDs, author, hearingImpaired, typeId, downloadUrl, url));
list.add(new SubsceneSubtitleDescriptor(name, lang, author, typeId, downloadUrl, url));
} catch (Exception e) {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.WARNING, "Cannot parse subtitle node", e);
}

View File

@ -11,9 +11,7 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
private final String title;
private final String language;
private final int numberOfCDs;
private final String author;
private final boolean hearingImpaired;
private final String typeId;
@ -21,12 +19,10 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
private final URL referer;
public SubsceneSubtitleDescriptor(String title, String language, int numberOfCDs, String author, boolean hearingImpaired, String typeId, URL downloadUrl, URL referer) {
public SubsceneSubtitleDescriptor(String title, String language, String author, String typeId, URL downloadUrl, URL referer) {
this.title = title;
this.language = language;
this.numberOfCDs = numberOfCDs;
this.author = author;
this.hearingImpaired = hearingImpaired;
this.typeId = typeId;
@ -46,21 +42,11 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
}
public int getNumberOfCDs() {
return numberOfCDs;
}
public String getAuthor() {
return author;
}
public boolean getHearingImpaired() {
return hearingImpaired;
}
@Override
public DownloadTask createDownloadTask() {
DownloadTask downloadTask = new DownloadTask(downloadUrl);