* 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 names = page.fetch().getHtml('utf-8')
|
||||
|
@ -10,7 +12,7 @@ names += anime.findResults{ it.getPrimaryTitle() }
|
|||
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.sort().unique()
|
||||
names = names*.toLowerCase().sort().unique()
|
||||
|
||||
|
||||
args[0].withOutputStream{ out ->
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<jar href="filebot.jar" download="eager" main="true" />
|
||||
<jar href="groovy.jar" download="eager" />
|
||||
<jar href="icu4j.jar" download="eager" />
|
||||
<jar href="commons-io.jar" download="eager" />
|
||||
<jar href="args4j.jar" download="eager" />
|
||||
<jar href="jna.jar" download="eager" />
|
||||
<jar href="miglayout.jar" download="eager" />
|
||||
|
@ -49,7 +50,6 @@
|
|||
<jar href="mediainfo.jar" download="lazy" part="native" />
|
||||
<jar href="nekohtml.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" />
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ public class MediaDetection {
|
|||
|
||||
// don't allow duplicates
|
||||
Map<String, String> unique = new LinkedHashMap<String, String>();
|
||||
for (String it : matches) {
|
||||
for (String it : names) {
|
||||
unique.put(it.toLowerCase(), it);
|
||||
}
|
||||
return new ArrayList<String>(unique.values());
|
||||
|
|
|
@ -72,6 +72,7 @@ class RenameAction extends AbstractAction {
|
|||
// move/renaming will probably take a while
|
||||
ProgressDialog dialog = createProgressDialog(window, renameJob);
|
||||
dialog.setLocation(getOffsetLocation(dialog.getOwner()));
|
||||
dialog.setIndeterminate(true);
|
||||
|
||||
// display progress dialog and stop blocking EDT
|
||||
window.setCursor(Cursor.getDefaultCursor());
|
||||
|
@ -170,8 +171,10 @@ class RenameAction extends AbstractAction {
|
|||
if (name.equals("currentFile")) {
|
||||
int i = job.renameLog.size();
|
||||
int n = job.renameMap.size();
|
||||
dialog.setProgress(i, 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);
|
||||
|
||||
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> persistentMovieFormat = Settings.forPackage(RenamePanel.class).entry("rename.format.movie");
|
||||
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()));
|
||||
|
||||
// restore state
|
||||
renameModel.setPreserveExtension(Boolean.parseBoolean(persistentPreserveExtension.getValue()));
|
||||
renameModel.setPreserveExtension(!Boolean.parseBoolean(persistentOverrideExtension.getValue()));
|
||||
|
||||
// filename formatter
|
||||
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
|
||||
|
@ -280,8 +280,8 @@ public class RenamePanel extends JComponent {
|
|||
|
||||
actionPopup.addDescription(new JLabel("Extension:"));
|
||||
|
||||
actionPopup.add(new PreserveExtensionAction(true, "Preserve", ResourceManager.getIcon("action.extension.preserve")));
|
||||
actionPopup.add(new PreserveExtensionAction(false, "Override", ResourceManager.getIcon("action.extension.override")));
|
||||
actionPopup.add(new OverrideExtensionAction(false, "Preserve", ResourceManager.getIcon("action.extension.preserve")));
|
||||
actionPopup.add(new OverrideExtensionAction(true, "Override", ResourceManager.getIcon("action.extension.override")));
|
||||
|
||||
actionPopup.addSeparator();
|
||||
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 PreserveExtensionAction(boolean activate, String name, Icon icon) {
|
||||
private OverrideExtensionAction(boolean activate, String name, Icon icon) {
|
||||
super(name, icon);
|
||||
this.activate = activate;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ public class RenamePanel extends JComponent {
|
|||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
renameModel.setPreserveExtension(activate);
|
||||
renameModel.setPreserveExtension(!activate);
|
||||
|
||||
// use different file name formatter
|
||||
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
|
||||
|
@ -348,7 +348,7 @@ public class RenamePanel extends JComponent {
|
|||
filesList.repaint();
|
||||
|
||||
// save state
|
||||
persistentPreserveExtension.setValue(Boolean.toString(activate));
|
||||
persistentOverrideExtension.setValue(Boolean.toString(activate));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,18 +77,14 @@ public final class FileUtilities {
|
|||
|
||||
|
||||
private static void moveFileIO(File source, File destination) throws IOException {
|
||||
if (!source.renameTo(destination)) {
|
||||
// use "copy and delete" as fallback if standard rename fails
|
||||
org.apache.commons.io.FileUtils.moveFile(source, destination);
|
||||
}
|
||||
// use "copy and delete" as fallback if standard rename fails
|
||||
org.apache.commons.io.FileUtils.moveFile(source, destination);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
org.apache.commons.io.FileUtils.moveDirectory(source, destination);
|
||||
}
|
||||
// use "copy and delete" as fallback if standard move/rename fails
|
||||
org.apache.commons.io.FileUtils.moveDirectory(source, destination);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ProgressDialog extends JDialog {
|
|||
|
||||
private final Cancellable cancellable;
|
||||
|
||||
|
||||
|
||||
public ProgressDialog(Window owner, Cancellable cancellable) {
|
||||
super(owner, ModalityType.DOCUMENT_MODAL);
|
||||
|
||||
|
@ -50,12 +50,17 @@ public class ProgressDialog extends JDialog {
|
|||
setSize(240, 155);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setIcon(Icon icon) {
|
||||
iconLabel.setIcon(icon);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setIndeterminate(boolean b) {
|
||||
progressBar.setIndeterminate(b);
|
||||
}
|
||||
|
||||
|
||||
public void setProgress(int value, int max) {
|
||||
progressBar.setIndeterminate(false);
|
||||
progressBar.setMinimum(0);
|
||||
|
@ -63,25 +68,30 @@ public class ProgressDialog extends JDialog {
|
|||
progressBar.setMaximum(max);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setNote(String text) {
|
||||
progressBar.setString(text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setTitle(String text) {
|
||||
super.setTitle(text);
|
||||
headerLabel.setText(text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setWindowTitle(String text) {
|
||||
super.setTitle(text);
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
setVisible(false);
|
||||
dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected final Action cancelAction = new AbstractAction("Cancel") {
|
||||
|
||||
@Override
|
||||
|
@ -91,12 +101,12 @@ public class ProgressDialog extends JDialog {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static interface Cancellable {
|
||||
|
||||
boolean isCancelled();
|
||||
|
||||
|
||||
|
||||
boolean cancel();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue