* don't query unused attributes for performance reasons
This commit is contained in:
parent
ff90a3f0df
commit
89e5310ec6
|
@ -76,7 +76,7 @@ public class SubsceneSubtitleClient extends SubtitleClient {
|
||||||
|
|
||||||
List<Node> nodes = XPathUtil.selectNodes("//TABLE[@class='filmSubtitleList']//A[@id]//ancestor::TR", dom);
|
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) {
|
for (Node node : nodes) {
|
||||||
try {
|
try {
|
||||||
|
@ -87,8 +87,6 @@ public class SubsceneSubtitleClient extends SubtitleClient {
|
||||||
String lang = XPathUtil.selectString("./SPAN[1]", linkNode);
|
String lang = XPathUtil.selectString("./SPAN[1]", linkNode);
|
||||||
String name = XPathUtil.selectString("./SPAN[2]", 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);
|
String author = XPathUtil.selectString("./TD[4]", node);
|
||||||
|
|
||||||
Matcher matcher = hrefPattern.matcher(href);
|
Matcher matcher = hrefPattern.matcher(href);
|
||||||
|
@ -101,7 +99,7 @@ public class SubsceneSubtitleClient extends SubtitleClient {
|
||||||
|
|
||||||
URL downloadUrl = getDownloadUrl(url, subtitleId, typeId);
|
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) {
|
} catch (Exception e) {
|
||||||
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.WARNING, "Cannot parse subtitle node", e);
|
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.WARNING, "Cannot parse subtitle node", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,7 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
|
||||||
|
|
||||||
private final String title;
|
private final String title;
|
||||||
private final String language;
|
private final String language;
|
||||||
private final int numberOfCDs;
|
|
||||||
private final String author;
|
private final String author;
|
||||||
private final boolean hearingImpaired;
|
|
||||||
|
|
||||||
private final String typeId;
|
private final String typeId;
|
||||||
|
|
||||||
|
@ -21,12 +19,10 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
|
||||||
private final URL referer;
|
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.title = title;
|
||||||
this.language = language;
|
this.language = language;
|
||||||
this.numberOfCDs = numberOfCDs;
|
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.hearingImpaired = hearingImpaired;
|
|
||||||
|
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
|
|
||||||
|
@ -46,21 +42,11 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getNumberOfCDs() {
|
|
||||||
return numberOfCDs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getAuthor() {
|
public String getAuthor() {
|
||||||
return author;
|
return author;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean getHearingImpaired() {
|
|
||||||
return hearingImpaired;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DownloadTask createDownloadTask() {
|
public DownloadTask createDownloadTask() {
|
||||||
DownloadTask downloadTask = new DownloadTask(downloadUrl);
|
DownloadTask downloadTask = new DownloadTask(downloadUrl);
|
||||||
|
|
Loading…
Reference in New Issue