From 6661dc001546d7443dfcc53541e55b85e2c17bc1 Mon Sep 17 00:00:00 2001
From: Reinhard Pointner
Date: Fri, 25 Nov 2011 19:43:24 +0000
Subject: [PATCH] * clean up and update docs
---
.../VideoHashSubtitleDownloadDialog.java | 11 +++++++++--
.../net/sourceforge/tuned/FileUtilities.java | 10 ++++++++++
website/cli.html | 19 ++++++++++++++-----
website/data/shell/subcpl.groovy | 19 +++++++++++++++++++
website/index.html | 7 ++-----
website/naming.html | 8 ++++----
6 files changed, 58 insertions(+), 16 deletions(-)
create mode 100644 website/data/shell/subcpl.groovy
diff --git a/source/net/sourceforge/filebot/ui/subtitle/VideoHashSubtitleDownloadDialog.java b/source/net/sourceforge/filebot/ui/subtitle/VideoHashSubtitleDownloadDialog.java
index 33b736a8..b0ec3ba9 100644
--- a/source/net/sourceforge/filebot/ui/subtitle/VideoHashSubtitleDownloadDialog.java
+++ b/source/net/sourceforge/filebot/ui/subtitle/VideoHashSubtitleDownloadDialog.java
@@ -178,9 +178,10 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
component.setIcon(ResourceManager.getIcon(service.getError() == null ? "database.ok" : "database.error"));
}
- servicePanel.setVisible(true);
component.setVisible(true);
component.setToolTipText(service.getError() == null ? null : service.getError().getMessage());
+ servicePanel.setVisible(true);
+ servicePanel.getParent().revalidate();
}
});
@@ -728,6 +729,9 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
if (isCancelled())
throw new CancellationException();
+ if (remainingVideos.isEmpty())
+ break;
+
Map> subtitleSet = new HashMap>();
for (final Entry> result : service.lookupSubtitles(remainingVideos, languageName).entrySet()) {
@@ -750,7 +754,7 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
publish(subtitleSet);
} catch (Exception e) {
- Logger.getLogger(VideoHashSubtitleDownloadDialog.class.getName()).log(Level.SEVERE, e.getMessage(), e);
+ Logger.getLogger(VideoHashSubtitleDownloadDialog.class.getName()).log(Level.WARNING, e.getMessage());
}
}
@@ -917,6 +921,9 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
// auto-detect query and search for subtitles
Collection querySet = new SeriesNameMatcher().matchAll(files.toArray(new File[0]));
List subtitles = findSubtitles(service, querySet, languageName);
+ if (subtitles.isEmpty()) {
+ throw new IllegalArgumentException("Unable to lookup subtitles:" + querySet);
+ }
// first match everything as best as possible, then filter possibly bad matches
Matcher matcher = new Matcher(files, subtitles, false, EpisodeMetrics.defaultSequence(true));
diff --git a/source/net/sourceforge/tuned/FileUtilities.java b/source/net/sourceforge/tuned/FileUtilities.java
index f6631880..398f96cd 100644
--- a/source/net/sourceforge/tuned/FileUtilities.java
+++ b/source/net/sourceforge/tuned/FileUtilities.java
@@ -223,6 +223,11 @@ public final class FileUtilities {
}
+ public static boolean isDerived(File derivate, File prime) {
+ return isDerived(getName(derivate), prime);
+ }
+
+
public static boolean isDerived(String derivate, File prime) {
String base = getName(prime).trim().toLowerCase();
derivate = derivate.trim().toLowerCase();
@@ -230,6 +235,11 @@ public final class FileUtilities {
}
+ public static boolean isDerivedByExtension(File derivate, File prime) {
+ return isDerivedByExtension(getName(derivate), prime);
+ }
+
+
public static boolean isDerivedByExtension(String derivate, File prime) {
String base = getName(prime).trim().toLowerCase();
derivate = derivate.trim().toLowerCase();
diff --git a/website/cli.html b/website/cli.html
index 6797b1af..73ac30ce 100644
--- a/website/cli.html
+++ b/website/cli.html
@@ -167,11 +167,6 @@
naming scheme |
movie or episode format expression |
-
- -non-strict |
- use less strict matching |
- |
-
-get-subtitles |
fetch subtitles |
@@ -187,6 +182,20 @@
2-letter language code |
en, de, fr, es, ja, zh, etc |
+
+ -non-strict |
+ use advanced matching |
+
+
+
+ Rename mode: match multiple tv shows |
+
+
+ Subtitle mode: match subtitles by name |
+
+
+ |
+
-check |
create/check verification file |
diff --git a/website/data/shell/subcpl.groovy b/website/data/shell/subcpl.groovy
new file mode 100644
index 00000000..b4987f8a
--- /dev/null
+++ b/website/data/shell/subcpl.groovy
@@ -0,0 +1,19 @@
+// filebot -script "http://filebot.sourceforge.net/data/shell/subcpl.groovy"
+
+import static net.sourceforge.tuned.FileUtilities.*;
+
+
+/*
+ * Fetch subtitles for all videos that currently don't have subtitles
+ */
+args.eachMediaFolder { dir ->
+ // select videos without subtitles
+ def videos = dir.listFiles().findAll{ video ->
+ video.isVideo() && !dir.listFiles().find{ sub ->
+ sub.isSubtitle() && isDerived(sub,video)
+ }
+ }
+
+ // fetch subtitles by hash only
+ getSubtitles(file:videos, strict:true)
+}
diff --git a/website/index.html b/website/index.html
index 8ab7e1db..5e21acf0 100644
--- a/website/index.html
+++ b/website/index.html
@@ -171,13 +171,10 @@
diff --git a/website/naming.html b/website/naming.html
index 9f4dd3f1..a416e8e5 100644
--- a/website/naming.html
+++ b/website/naming.html
@@ -238,7 +238,7 @@
fn |
file name |
Serenity |
-
+
ext |
file extension |
@@ -253,7 +253,7 @@
movie |
movie object |
<default movie name> |
-
+
pi |
movie part index |
@@ -293,7 +293,7 @@
text |
subtitle object [stream 0] |
<any subtitle parameter> |
-
+
@@ -308,7 +308,7 @@
space(replacement)
Replace all spaces (e.g. "Doctor Who" -> "Doctor_Who").
-
+
upperInitial()
Upper-case all initials (e.g. "The Day a new Demon was born" -> "The Day A New Demon Was Born").