1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18:52 -05:00

* fix local file script call

* stop any unnecessary scraping of subscene
This commit is contained in:
Reinhard Pointner 2012-04-09 14:37:16 +00:00
parent 32b2d35e0c
commit ec796fc478
2 changed files with 15 additions and 14 deletions

View File

@ -9,6 +9,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@ -145,8 +146,8 @@ public class ArgumentBean {
public URI getScriptLocation() {
try {
return new URI(script);
} catch (URISyntaxException eu) {
return new URL(script).toURI();
} catch (Exception eu) {
if (script.startsWith("script://")) {
try {
return new URI("script", script.substring(9), null, null, null);

View File

@ -24,32 +24,32 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
private URL subtitlePage;
private Map<String, String> subtitleInfo;
public SubsceneSubtitleDescriptor(String title, String language, URL subtitlePage) {
this.title = title;
this.language = language;
this.subtitlePage = subtitlePage;
}
@Override
public String getName() {
return title;
}
@Override
public String getLanguageName() {
return language;
}
@Override
public String getType() {
return null;
}
@Override
public ByteBuffer fetch() throws Exception {
// e.g. http://subscene.com/english/Firefly-The-Complete-Series/subtitle-40003-dlpath-20008/rar.zipx
@ -65,7 +65,7 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
return WebRequest.post(connection, downloadPostData);
}
private synchronized Map<String, String> getSubtitleInfo() {
// extract subtitle information from subtitle page if necessary
if (subtitleInfo == null) {
@ -84,25 +84,25 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
return subtitleInfo;
}
@Override
public String getPath() {
return String.format("%s.%s", getName(), getSubtitleInfo().get("typeId"));
return String.format("%s.%s", getName(), subtitleInfo == null ? null : subtitleInfo.get("typeId"));
}
@Override
public long getLength() {
return -1;
}
@Override
public int hashCode() {
return subtitlePage.getPath().hashCode();
}
@Override
public boolean equals(Object object) {
if (object instanceof SubsceneSubtitleDescriptor) {
@ -113,7 +113,7 @@ public class SubsceneSubtitleDescriptor implements SubtitleDescriptor {
return false;
}
@Override
public String toString() {
return String.format("%s [%s]", getName(), getLanguageName());