* all users will now require authentication when using OpenSubtitles
This commit is contained in:
parent
8fe8e4d400
commit
834b8b5205
|
@ -74,6 +74,7 @@ import net.filebot.web.MovieFormat;
|
|||
import net.filebot.web.MovieIdentificationService;
|
||||
import net.filebot.web.MoviePart;
|
||||
import net.filebot.web.MusicIdentificationService;
|
||||
import net.filebot.web.OpenSubtitlesClient;
|
||||
import net.filebot.web.SearchResult;
|
||||
import net.filebot.web.SortOrder;
|
||||
import net.filebot.web.SubtitleDescriptor;
|
||||
|
@ -720,7 +721,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
|
||||
// lookup subtitles by hash
|
||||
for (VideoHashSubtitleService service : getVideoHashSubtitleServices()) {
|
||||
if (remainingVideos.isEmpty() || (databaseFilter != null && !databaseFilter.matcher(service.getName()).matches())) {
|
||||
if (remainingVideos.isEmpty() || (databaseFilter != null && !databaseFilter.matcher(service.getName()).matches()) || !requireLogin(service)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -736,7 +737,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
}
|
||||
|
||||
for (SubtitleProvider service : getSubtitleProviders()) {
|
||||
if (strict || remainingVideos.isEmpty() || (databaseFilter != null && !databaseFilter.matcher(service.getName()).matches())) {
|
||||
if (strict || remainingVideos.isEmpty() || (databaseFilter != null && !databaseFilter.matcher(service.getName()).matches()) || !requireLogin(service)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -766,6 +767,16 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
return subtitleFiles;
|
||||
}
|
||||
|
||||
private static boolean requireLogin(Object service) {
|
||||
if (service instanceof OpenSubtitlesClient) {
|
||||
OpenSubtitlesClient osdb = (OpenSubtitlesClient) service;
|
||||
if (osdb.isAnonymous()) {
|
||||
throw new CmdlineException(String.format("%s: Please enter your login details by calling `filebot -script fn:osdb.login`", osdb.getName()));
|
||||
}
|
||||
}
|
||||
return true; // no login => logged in by default
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<File> getMissingSubtitles(Collection<File> files, String db, String query, final String languageName, String output, String csn, final String format, boolean strict) throws Exception {
|
||||
List<File> videoFiles = filter(filter(files, VIDEO_FILES), new FileFilter() {
|
||||
|
|
Loading…
Reference in New Issue