* EpisodeFormatDialog: initialize selectedOption with Option.CANCEL
* RenameListCellRenderer: don't display type label in name list * EpisodeFormatBindingBean: get cache only when needed
This commit is contained in:
parent
d5a5b93b3b
commit
4c926c076e
|
@ -200,12 +200,12 @@ public class EpisodeFormatBindingBean {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Cache checksumCache = CacheManager.getInstance().getCache("checksum");
|
|
||||||
|
|
||||||
|
|
||||||
private String crc32(File file) throws IOException, InterruptedException {
|
private String crc32(File file) throws IOException, InterruptedException {
|
||||||
// try to get checksum from cache
|
// try to get checksum from cache
|
||||||
Element cacheEntry = checksumCache.get(file);
|
Cache cache = CacheManager.getInstance().getCache("checksum");
|
||||||
|
|
||||||
|
Element cacheEntry = cache.get(file);
|
||||||
|
|
||||||
if (cacheEntry != null) {
|
if (cacheEntry != null) {
|
||||||
return (String) cacheEntry.getValue();
|
return (String) cacheEntry.getValue();
|
||||||
|
@ -232,7 +232,7 @@ public class EpisodeFormatBindingBean {
|
||||||
|
|
||||||
String checksum = String.format("%08X", crc.getValue());
|
String checksum = String.format("%08X", crc.getValue());
|
||||||
|
|
||||||
checksumCache.put(new Element(file, checksum));
|
cache.put(new Element(file, checksum));
|
||||||
return checksum;
|
return checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ import net.sourceforge.tuned.ui.notification.SeparatorBorder.Position;
|
||||||
|
|
||||||
public class EpisodeFormatDialog extends JDialog {
|
public class EpisodeFormatDialog extends JDialog {
|
||||||
|
|
||||||
private Option selectedOption = null;
|
private Option selectedOption = Option.CANCEL;
|
||||||
|
|
||||||
private JLabel preview = new JLabel();
|
private JLabel preview = new JLabel();
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@ import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sourceforge.filebot.ResourceManager;
|
import net.sourceforge.filebot.ResourceManager;
|
||||||
import net.sourceforge.filebot.similarity.Match;
|
|
||||||
import net.sourceforge.filebot.ui.panel.rename.RenameModel.FormattedFuture;
|
import net.sourceforge.filebot.ui.panel.rename.RenameModel.FormattedFuture;
|
||||||
import net.sourceforge.filebot.web.Episode;
|
|
||||||
import net.sourceforge.tuned.FileUtilities;
|
import net.sourceforge.tuned.FileUtilities;
|
||||||
import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer;
|
import net.sourceforge.tuned.ui.DefaultFancyListCellRenderer;
|
||||||
|
|
||||||
|
@ -73,8 +71,6 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
|
||||||
setIcon(ResourceManager.getIcon("worker.started"));
|
setIcon(ResourceManager.getIcon("worker.started"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
typeLabel.setText(getType(future.getMatch()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!renameModel.hasComplement(index)) {
|
if (!renameModel.hasComplement(index)) {
|
||||||
|
@ -102,21 +98,6 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String getType(Match<Object, File> match) {
|
|
||||||
Object source = match.getValue();
|
|
||||||
|
|
||||||
if (source instanceof Episode) {
|
|
||||||
return "Episode";
|
|
||||||
} else if (source instanceof AbstractFileEntry) {
|
|
||||||
return "Torrent";
|
|
||||||
} else if (source instanceof File) {
|
|
||||||
return "File";
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class TypeLabel extends JLabel {
|
private class TypeLabel extends JLabel {
|
||||||
|
|
||||||
private final Insets margin = new Insets(0, 10, 0, 0);
|
private final Insets margin = new Insets(0, 10, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue