1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-17 06:45:06 -05:00

* utorrent-postprocess: support fetching of subtitles in multiple languages using --def subtitles=en,de,...

This commit is contained in:
Reinhard Pointner 2013-01-19 17:04:15 +00:00
parent bc2fcadedc
commit b1de604df8
2 changed files with 6 additions and 4 deletions

View File

@ -621,6 +621,7 @@ public class CmdlineOperations implements CmdlineInterface {
public List<File> getSubtitles(Collection<File> files, String db, String query, String languageName, String output, String csn, boolean strict) throws Exception {
final Language language = getLanguage(languageName);
final Pattern databaseFilter = (db != null) ? Pattern.compile(db, Pattern.CASE_INSENSITIVE) : null;
CLILogger.finest(String.format("Get [%s] subtitles for %d files", language.getName(), files.size()));
// when rewriting subtitles to target format an encoding must be defined, default to UTF-8
final Charset outputEncoding = (csn != null) ? Charset.forName(csn) : (output != null) ? Charset.forName("UTF-8") : null;
@ -743,7 +744,6 @@ public class CmdlineOperations implements CmdlineInterface {
return emptyList();
}
CLILogger.finest(format("Missing subtitles for %d video files", videoFiles.size()));
return getSubtitles(videoFiles, db, query, languageName, output, csn, strict);
}

View File

@ -12,7 +12,7 @@ if (tryQuietly{ ut_state != ut_state_allow }) {
}
// enable/disable features as specified via --def parameters
def subtitles = tryQuietly{ subtitles.toBoolean() }
def subtitles = tryQuietly{ subtitles.toBoolean() ? ['en'] : subtitles.split(/[ ,|]+/).findAll{ it.length() >= 2 } }
def artwork = tryQuietly{ artwork.toBoolean() }
def backdrops = tryQuietly{ backdrops.toBoolean() }
def clean = tryQuietly{ clean.toBoolean() }
@ -28,7 +28,7 @@ def gmail = tryQuietly{ gmail.split(':', 2) }
// series/anime/movie format expressions
def format = [
tvs: tryQuietly{ seriesFormat } ?: '''TV Shows/{n}/{episode.special ? "Special" : "Season "+s}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}''',
tvs: tryQuietly{ seriesFormat } ?: '''TV Shows/{n}/{episode.special ? "Special" : "Season "+s}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}{".$lang"}''',
anime: tryQuietly{ animeFormat } ?: '''Anime/{n}/{n} - {sxe} - {t}''',
mov: tryQuietly{ movieFormat } ?: '''Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',
music: tryQuietly{ musicFormat } ?: '''Music/{n}/{album}/{n} - {t}'''
@ -148,7 +148,9 @@ groups.each{ group, files -> _log.finest("Group: $group => ${files*.name}") }
groups.each{ group, files ->
// fetch subtitles
if (subtitles) {
files += getMissingSubtitles(file:files, output:"srt", encoding:"utf-8")
subtitles.each{ languageCode ->
files += getMissingSubtitles(file:files, output:'srt', encoding:'UTF-8', lang:languageCode)
}
}
// EPISODE MODE