* various little fixes / improvements
This commit is contained in:
parent
327f71ce5b
commit
12aa612bd4
|
@ -1,3 +1,5 @@
|
||||||
|
// filebot -script BuildData.groovy -trust-script "website/data/series.list.gz"
|
||||||
|
|
||||||
def page = new URL('http://thetvdb.com/?string=&searchseriesid=&tab=listseries&function=Search')
|
def page = new URL('http://thetvdb.com/?string=&searchseriesid=&tab=listseries&function=Search')
|
||||||
|
|
||||||
def names = page.fetch().getHtml('utf-8')
|
def names = page.fetch().getHtml('utf-8')
|
||||||
|
@ -10,7 +12,7 @@ names += anime.findResults{ it.getPrimaryTitle() }
|
||||||
names += anime.findResults{ it.getOfficialTitle('en') }
|
names += anime.findResults{ it.getOfficialTitle('en') }
|
||||||
|
|
||||||
names = names.findAll{ it =~ /^[A-Z]/ && it =~ /[\p{Alpha}]{3}/}.findResults{ net.sourceforge.filebot.similarity.Normalization.normalizePunctuation(it) }
|
names = names.findAll{ it =~ /^[A-Z]/ && it =~ /[\p{Alpha}]{3}/}.findResults{ net.sourceforge.filebot.similarity.Normalization.normalizePunctuation(it) }
|
||||||
names = names.sort().unique()
|
names = names*.toLowerCase().sort().unique()
|
||||||
|
|
||||||
|
|
||||||
args[0].withOutputStream{ out ->
|
args[0].withOutputStream{ out ->
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<jar href="filebot.jar" download="eager" main="true" />
|
<jar href="filebot.jar" download="eager" main="true" />
|
||||||
<jar href="groovy.jar" download="eager" />
|
<jar href="groovy.jar" download="eager" />
|
||||||
<jar href="icu4j.jar" download="eager" />
|
<jar href="icu4j.jar" download="eager" />
|
||||||
|
<jar href="commons-io.jar" download="eager" />
|
||||||
<jar href="args4j.jar" download="eager" />
|
<jar href="args4j.jar" download="eager" />
|
||||||
<jar href="jna.jar" download="eager" />
|
<jar href="jna.jar" download="eager" />
|
||||||
<jar href="miglayout.jar" download="eager" />
|
<jar href="miglayout.jar" download="eager" />
|
||||||
|
@ -49,7 +50,6 @@
|
||||||
<jar href="mediainfo.jar" download="lazy" part="native" />
|
<jar href="mediainfo.jar" download="lazy" part="native" />
|
||||||
<jar href="nekohtml.jar" download="lazy" part="scraper" />
|
<jar href="nekohtml.jar" download="lazy" part="scraper" />
|
||||||
<jar href="xercesImpl.jar" download="lazy" part="scraper" />
|
<jar href="xercesImpl.jar" download="lazy" part="scraper" />
|
||||||
<jar href="commons-io.jar" download="lazy" />
|
|
||||||
<jar href="junrar-custom.jar" download="lazy" />
|
<jar href="junrar-custom.jar" download="lazy" />
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class MediaDetection {
|
||||||
|
|
||||||
// don't allow duplicates
|
// don't allow duplicates
|
||||||
Map<String, String> unique = new LinkedHashMap<String, String>();
|
Map<String, String> unique = new LinkedHashMap<String, String>();
|
||||||
for (String it : matches) {
|
for (String it : names) {
|
||||||
unique.put(it.toLowerCase(), it);
|
unique.put(it.toLowerCase(), it);
|
||||||
}
|
}
|
||||||
return new ArrayList<String>(unique.values());
|
return new ArrayList<String>(unique.values());
|
||||||
|
|
|
@ -72,6 +72,7 @@ class RenameAction extends AbstractAction {
|
||||||
// move/renaming will probably take a while
|
// move/renaming will probably take a while
|
||||||
ProgressDialog dialog = createProgressDialog(window, renameJob);
|
ProgressDialog dialog = createProgressDialog(window, renameJob);
|
||||||
dialog.setLocation(getOffsetLocation(dialog.getOwner()));
|
dialog.setLocation(getOffsetLocation(dialog.getOwner()));
|
||||||
|
dialog.setIndeterminate(true);
|
||||||
|
|
||||||
// display progress dialog and stop blocking EDT
|
// display progress dialog and stop blocking EDT
|
||||||
window.setCursor(Cursor.getDefaultCursor());
|
window.setCursor(Cursor.getDefaultCursor());
|
||||||
|
@ -170,8 +171,10 @@ class RenameAction extends AbstractAction {
|
||||||
if (name.equals("currentFile")) {
|
if (name.equals("currentFile")) {
|
||||||
int i = job.renameLog.size();
|
int i = job.renameLog.size();
|
||||||
int n = job.renameMap.size();
|
int n = job.renameMap.size();
|
||||||
dialog.setProgress(i, n);
|
|
||||||
dialog.setNote(String.format("%d of %d", i + 1, n));
|
dialog.setNote(String.format("%d of %d", i + 1, n));
|
||||||
|
if (newValue instanceof File) {
|
||||||
|
dialog.setWindowTitle("Moving " + ((File) oldValue).getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class RenamePanel extends JComponent {
|
||||||
|
|
||||||
protected final RenameAction renameAction = new RenameAction(renameModel);
|
protected final RenameAction renameAction = new RenameAction(renameModel);
|
||||||
|
|
||||||
private static final PreferencesEntry<String> persistentPreserveExtension = Settings.forPackage(RenamePanel.class).entry("rename.extension.preserve").defaultValue("true");
|
private static final PreferencesEntry<String> persistentOverrideExtension = Settings.forPackage(RenamePanel.class).entry("rename.extension.override").defaultValue("false");
|
||||||
private static final PreferencesEntry<String> persistentEpisodeFormat = Settings.forPackage(RenamePanel.class).entry("rename.format.episode");
|
private static final PreferencesEntry<String> persistentEpisodeFormat = Settings.forPackage(RenamePanel.class).entry("rename.format.episode");
|
||||||
private static final PreferencesEntry<String> persistentMovieFormat = Settings.forPackage(RenamePanel.class).entry("rename.format.movie");
|
private static final PreferencesEntry<String> persistentMovieFormat = Settings.forPackage(RenamePanel.class).entry("rename.format.movie");
|
||||||
private static final PreferencesEntry<String> persistentPreferredLanguage = Settings.forPackage(RenamePanel.class).entry("rename.language").defaultValue("en");
|
private static final PreferencesEntry<String> persistentPreferredLanguage = Settings.forPackage(RenamePanel.class).entry("rename.language").defaultValue("en");
|
||||||
|
@ -88,7 +88,7 @@ public class RenamePanel extends JComponent {
|
||||||
filesList.setTransferablePolicy(new FilesListTransferablePolicy(renameModel.files()));
|
filesList.setTransferablePolicy(new FilesListTransferablePolicy(renameModel.files()));
|
||||||
|
|
||||||
// restore state
|
// restore state
|
||||||
renameModel.setPreserveExtension(Boolean.parseBoolean(persistentPreserveExtension.getValue()));
|
renameModel.setPreserveExtension(!Boolean.parseBoolean(persistentOverrideExtension.getValue()));
|
||||||
|
|
||||||
// filename formatter
|
// filename formatter
|
||||||
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
|
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
|
||||||
|
@ -280,8 +280,8 @@ public class RenamePanel extends JComponent {
|
||||||
|
|
||||||
actionPopup.addDescription(new JLabel("Extension:"));
|
actionPopup.addDescription(new JLabel("Extension:"));
|
||||||
|
|
||||||
actionPopup.add(new PreserveExtensionAction(true, "Preserve", ResourceManager.getIcon("action.extension.preserve")));
|
actionPopup.add(new OverrideExtensionAction(false, "Preserve", ResourceManager.getIcon("action.extension.preserve")));
|
||||||
actionPopup.add(new PreserveExtensionAction(false, "Override", ResourceManager.getIcon("action.extension.override")));
|
actionPopup.add(new OverrideExtensionAction(true, "Override", ResourceManager.getIcon("action.extension.override")));
|
||||||
|
|
||||||
actionPopup.addSeparator();
|
actionPopup.addSeparator();
|
||||||
actionPopup.addDescription(new JLabel("History:"));
|
actionPopup.addDescription(new JLabel("History:"));
|
||||||
|
@ -326,12 +326,12 @@ public class RenamePanel extends JComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
protected class PreserveExtensionAction extends AbstractAction {
|
protected class OverrideExtensionAction extends AbstractAction {
|
||||||
|
|
||||||
private final boolean activate;
|
private final boolean activate;
|
||||||
|
|
||||||
|
|
||||||
private PreserveExtensionAction(boolean activate, String name, Icon icon) {
|
private OverrideExtensionAction(boolean activate, String name, Icon icon) {
|
||||||
super(name, icon);
|
super(name, icon);
|
||||||
this.activate = activate;
|
this.activate = activate;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ public class RenamePanel extends JComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
renameModel.setPreserveExtension(activate);
|
renameModel.setPreserveExtension(!activate);
|
||||||
|
|
||||||
// use different file name formatter
|
// use different file name formatter
|
||||||
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
|
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
|
||||||
|
@ -348,7 +348,7 @@ public class RenamePanel extends JComponent {
|
||||||
filesList.repaint();
|
filesList.repaint();
|
||||||
|
|
||||||
// save state
|
// save state
|
||||||
persistentPreserveExtension.setValue(Boolean.toString(activate));
|
persistentOverrideExtension.setValue(Boolean.toString(activate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,19 +77,15 @@ public final class FileUtilities {
|
||||||
|
|
||||||
|
|
||||||
private static void moveFileIO(File source, File destination) throws IOException {
|
private static void moveFileIO(File source, File destination) throws IOException {
|
||||||
if (!source.renameTo(destination)) {
|
|
||||||
// use "copy and delete" as fallback if standard rename fails
|
// use "copy and delete" as fallback if standard rename fails
|
||||||
org.apache.commons.io.FileUtils.moveFile(source, destination);
|
org.apache.commons.io.FileUtils.moveFile(source, destination);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static void moveFolderIO(File source, File destination) throws IOException {
|
private static void moveFolderIO(File source, File destination) throws IOException {
|
||||||
if (!source.renameTo(destination)) {
|
|
||||||
// use "copy and delete" as fallback if standard move/rename fails
|
// use "copy and delete" as fallback if standard move/rename fails
|
||||||
org.apache.commons.io.FileUtils.moveDirectory(source, destination);
|
org.apache.commons.io.FileUtils.moveDirectory(source, destination);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static File copyAs(File source, File destination) throws IOException {
|
public static File copyAs(File source, File destination) throws IOException {
|
||||||
|
|
|
@ -56,6 +56,11 @@ public class ProgressDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setIndeterminate(boolean b) {
|
||||||
|
progressBar.setIndeterminate(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setProgress(int value, int max) {
|
public void setProgress(int value, int max) {
|
||||||
progressBar.setIndeterminate(false);
|
progressBar.setIndeterminate(false);
|
||||||
progressBar.setMinimum(0);
|
progressBar.setMinimum(0);
|
||||||
|
@ -76,6 +81,11 @@ public class ProgressDialog extends JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setWindowTitle(String text) {
|
||||||
|
super.setTitle(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
dispose();
|
dispose();
|
||||||
|
|
Loading…
Reference in New Issue