* improve stability
This commit is contained in:
parent
bb6837fd4b
commit
d94c85ab00
|
@ -122,6 +122,8 @@ def thetvdb_index = thetvdb_index_url.fetch().getHtml('UTF-8')
|
|||
.depthFirst().TR.findAll{ it.TD.size() == 3 && it.TD[1].text() == 'English' && it.TD[0].A.text() }
|
||||
.findResults{ [it.TD[2].text(), it.TD[0].A.text()] }
|
||||
|
||||
thetvdb_index = thetvdb_index.findResults{ [it[0] as Integer, it[1].replaceAll(/\s+/, ' ').trim()] }.findAll{ !(it[1] =~ /(?i:duplicate)/ || it[1] =~ /\d{6,}/ || it[1].startsWith('*') || it[1].endsWith('*') || it[1].empty) } as HashSet
|
||||
|
||||
// join and sort
|
||||
def thetvdb = thetvdb_index.findResults{ [it[0].pad(6), it[1]].join('\t') }.sort()
|
||||
gz(thetvdb_out, thetvdb)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<property name="application.update" value="skip" />
|
||||
<property name="unixfs" value="false" />
|
||||
<property name="useNativeShell" value="false" />
|
||||
<property name="useExtendedFileAttributes" value="true" />
|
||||
<property name="useExtendedFileAttributes" value="false" />
|
||||
<property name="java.net.useSystemProxies" value="true" />
|
||||
<property name="sun.net.client.defaultConnectTimeout" value="10000" />
|
||||
<property name="sun.net.client.defaultReadTimeout" value="60000" />
|
||||
|
|
|
@ -47,6 +47,7 @@ File.metaClass.copyTo = { dir -> copyAs(delegate, new File(dir, delegate.getName
|
|||
File.metaClass.getXattr = { new net.sourceforge.filebot.MetaAttributeView(delegate) }
|
||||
List.metaClass.mapByFolder = { mapByFolder(delegate) }
|
||||
List.metaClass.mapByExtension = { mapByExtension(delegate) }
|
||||
String.metaClass.getNameWithoutExtension = { getNameWithoutExtension(delegate) }
|
||||
String.metaClass.getExtension = { getExtension(delegate) }
|
||||
String.metaClass.hasExtension = { String... ext -> hasExtension(delegate, ext) }
|
||||
String.metaClass.validateFileName = { validateFileName(delegate) }
|
||||
|
|
|
@ -342,7 +342,7 @@ public class ReleaseInfo {
|
|||
Scanner scanner = new Scanner(new GZIPInputStream(new ByteBufferInputStream(data)), "UTF-8").useDelimiter("\t|\n");
|
||||
|
||||
List<TheTVDBSearchResult> tvshows = new ArrayList<TheTVDBSearchResult>();
|
||||
while (scanner.hasNext()) {
|
||||
while (scanner.hasNext() && scanner.hasNextInt()) {
|
||||
int id = scanner.nextInt();
|
||||
String name = scanner.next().trim();
|
||||
tvshows.add(new TheTVDBSearchResult(name, id));
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class OpenSubtitlesHasher {
|
|||
public static final int HASH_CHUNK_SIZE = 64 * 1024;
|
||||
|
||||
|
||||
public static String computeHash(File file) throws IOException {
|
||||
public static String computeHashNIO(File file) throws IOException {
|
||||
long size = file.length();
|
||||
long chunkSizeForFile = Math.min(HASH_CHUNK_SIZE, size);
|
||||
|
||||
|
@ -43,6 +43,16 @@ public final class OpenSubtitlesHasher {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static String computeHash(File file) throws IOException {
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
try {
|
||||
return computeHash(in, file.length());
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String computeHash(InputStream stream, long length) throws IOException {
|
||||
int chunkSizeForFile = (int) Math.min(HASH_CHUNK_SIZE, length);
|
||||
|
|
Loading…
Reference in New Issue