* more easy-to-understand default values for the noobs
This commit is contained in:
parent
cd924f5fc5
commit
b6358fa466
|
@ -27,6 +27,7 @@ import java.text.Format;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
@ -118,14 +119,7 @@ public class FormatDialog extends JDialog {
|
||||||
|
|
||||||
public Mode next() {
|
public Mode next() {
|
||||||
// cycle through Episode -> Movie -> Music (but ignore generic File mode)
|
// cycle through Episode -> Movie -> Music (but ignore generic File mode)
|
||||||
switch (this) {
|
return values()[(this.ordinal() + 1) % File.ordinal()];
|
||||||
case Episode:
|
|
||||||
return Movie;
|
|
||||||
case Movie:
|
|
||||||
return Music;
|
|
||||||
default:
|
|
||||||
return Episode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String key() {
|
public String key() {
|
||||||
|
@ -152,6 +146,23 @@ public class FormatDialog extends JDialog {
|
||||||
public PreferencesList<String> persistentFormatHistory() {
|
public PreferencesList<String> persistentFormatHistory() {
|
||||||
return Settings.forPackage(FormatDialog.class).node("format.recent." + key()).asList();
|
return Settings.forPackage(FormatDialog.class).node("format.recent." + key()).asList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDefaultFormatExpression() {
|
||||||
|
return getSampleExpressions().iterator().next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterable<String> getSampleExpressions() {
|
||||||
|
ResourceBundle bundle = ResourceBundle.getBundle(FormatDialog.class.getName());
|
||||||
|
Map<String, String> examples = new TreeMap<String, String>();
|
||||||
|
|
||||||
|
// extract all example entries and sort by key
|
||||||
|
String prefix = key() + ".example";
|
||||||
|
for (String key : bundle.keySet()) {
|
||||||
|
if (key.startsWith(prefix))
|
||||||
|
examples.put(key, bundle.getString(key));
|
||||||
|
}
|
||||||
|
return examples.values();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormatDialog(Window owner, Mode initMode, MediaBindingBean lockOnBinding) {
|
public FormatDialog(Window owner, Mode initMode, MediaBindingBean lockOnBinding) {
|
||||||
|
@ -192,7 +203,9 @@ public class FormatDialog extends JDialog {
|
||||||
|
|
||||||
content.add(help, "growx, wrap 25px:push");
|
content.add(help, "growx, wrap 25px:push");
|
||||||
|
|
||||||
|
if (lockOnBinding == null) {
|
||||||
content.add(new JButton(switchEditModeAction), "tag left");
|
content.add(new JButton(switchEditModeAction), "tag left");
|
||||||
|
}
|
||||||
content.add(new JButton(approveFormatAction), "tag apply");
|
content.add(new JButton(approveFormatAction), "tag apply");
|
||||||
content.add(new JButton(cancelAction), "tag cancel");
|
content.add(new JButton(cancelAction), "tag cancel");
|
||||||
|
|
||||||
|
@ -271,7 +284,7 @@ public class FormatDialog extends JDialog {
|
||||||
sample = bindings;
|
sample = bindings;
|
||||||
|
|
||||||
// restore editor state
|
// restore editor state
|
||||||
setFormatCode(mode.persistentFormatHistory().isEmpty() ? "" : mode.persistentFormatHistory().get(0));
|
setFormatCode(mode.persistentFormatHistory().isEmpty() ? mode.getDefaultFormatExpression() : mode.persistentFormatHistory().get(0));
|
||||||
|
|
||||||
// update examples
|
// update examples
|
||||||
fireSampleChanged();
|
fireSampleChanged();
|
||||||
|
@ -359,16 +372,7 @@ public class FormatDialog extends JDialog {
|
||||||
panel.setBorder(createLineBorder(new Color(0xACA899)));
|
panel.setBorder(createLineBorder(new Color(0xACA899)));
|
||||||
panel.setBackground(new Color(0xFFFFE1));
|
panel.setBackground(new Color(0xFFFFE1));
|
||||||
|
|
||||||
ResourceBundle bundle = ResourceBundle.getBundle(getClass().getName());
|
for (final String format : mode.getSampleExpressions()) {
|
||||||
TreeMap<String, String> examples = new TreeMap<String, String>();
|
|
||||||
|
|
||||||
// extract all example entries and sort by key
|
|
||||||
for (String key : bundle.keySet()) {
|
|
||||||
if (key.startsWith(mode.key() + ".example"))
|
|
||||||
examples.put(key, bundle.getString(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final String format : examples.values()) {
|
|
||||||
LinkButton formatLink = new LinkButton(new AbstractAction(format) {
|
LinkButton formatLink = new LinkButton(new AbstractAction(format) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,10 +10,10 @@ episode.sample: {"@type":"net.filebot.web.Episode","seriesName":"Firefly","serie
|
||||||
movie.sample: {"@type":"net.filebot.web.MoviePart","partIndex":1,"partCount":2,"year":2009,"imdbId":-1,"tmdbId":19995,"name":"Avatar","aliasNames":[]}
|
movie.sample: {"@type":"net.filebot.web.MoviePart","partIndex":1,"partCount":2,"year":2009,"imdbId":-1,"tmdbId":19995,"name":"Avatar","aliasNames":[]}
|
||||||
music.sample: {"@type":"net.filebot.web.AudioTrack","artist":"Leona Lewis","title":"I See You","album":"Avatar","albumArtist":"James Horner","trackTitle":null,"albumReleaseDate":{"year":2009,"month":12,"day":11},"mediumIndex":1,"mediumCount":1,"trackIndex":14,"trackCount":14}
|
music.sample: {"@type":"net.filebot.web.AudioTrack","artist":"Leona Lewis","title":"I See You","album":"Avatar","albumArtist":"James Horner","trackTitle":null,"albumReleaseDate":{"year":2009,"month":12,"day":11},"mediumIndex":1,"mediumCount":1,"trackIndex":14,"trackCount":14}
|
||||||
|
|
||||||
# basic 1.01
|
# 1x01
|
||||||
episode.example[0]: {n} - {s}.{e} - {t}
|
episode.example[0]: {n} - {sxe} - {t}
|
||||||
# S01E01
|
# S00E00
|
||||||
episode.example[1]: {n} - {sxe} - {t}
|
episode.example[1]: {n} - {s00e00} - {t}
|
||||||
# airdate
|
# airdate
|
||||||
episode.example[2]: {n} [{airdate}] {t}
|
episode.example[2]: {n} [{airdate}] {t}
|
||||||
# uglyfy name
|
# uglyfy name
|
||||||
|
@ -23,7 +23,7 @@ episode.example[4]: {n}/{'Season '+s.pad(2)}/{s00e00} - {t}
|
||||||
|
|
||||||
# simple name/year
|
# simple name/year
|
||||||
movie.example[0]: {n} ({y}){' CD'+pi}{'.'+lang}
|
movie.example[0]: {n} ({y}){' CD'+pi}{'.'+lang}
|
||||||
# media info name
|
# name/year and media info
|
||||||
movie.example[1]: {n} ({y}, {director}) {vf} {af}
|
movie.example[1]: {n} ({y}, {director}) {vf} {af}
|
||||||
# name/year and ratings
|
# name/year and ratings
|
||||||
movie.example[2]: {n} {[y, certification, rating]}
|
movie.example[2]: {n} {[y, certification, rating]}
|
||||||
|
|
Loading…
Reference in New Issue