1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

* start {i} row index binding with 1 instead of 0

This commit is contained in:
Reinhard Pointner 2014-08-22 16:36:12 +00:00
parent daaf51622b
commit d601634e13
4 changed files with 9 additions and 6 deletions

View File

@ -561,7 +561,7 @@ public class CmdlineOperations implements CmdlineInterface {
Map<File, File> renameMap = new LinkedHashMap<File, File>();
for (Entry<File, Object> it : service.getMetaData(selection).entrySet()) {
MediaBindingBean bindingBean = new MediaBindingBean(it.getValue(), it.getKey(), null);
MediaBindingBean bindingBean = new MediaBindingBean(it.getValue(), it.getKey());
if (filter == null || filter.matches(bindingBean)) {
String newName = (format != null) ? format.format(bindingBean) : validateFileName(it.getValue().toString());

View File

@ -64,6 +64,10 @@ public class MediaBindingBean {
private MediaInfo mediaInfo;
private Object metaInfo;
public MediaBindingBean(Object infoObject, File mediaFile) {
this(infoObject, mediaFile, singletonMap(mediaFile, infoObject));
}
public MediaBindingBean(Object infoObject, File mediaFile, Map<File, Object> context) {
this.infoObject = infoObject;
this.mediaFile = mediaFile;
@ -756,7 +760,7 @@ public class MediaBindingBean {
@Define("i")
public Integer getModelIndex() {
return identityIndexOf(context.values(), getInfoObject());
return 1 + identityIndexOf(context.values(), getInfoObject());
}
@Define("di")

View File

@ -110,7 +110,7 @@ class BindingDialog extends JDialog {
if (bindingModel.executor.isShutdown())
return;
bindingModel.setModel(getSampleExpressions(), new MediaBindingBean(getInfoObject(), getMediaFile(), null));
bindingModel.setModel(getSampleExpressions(), new MediaBindingBean(getInfoObject(), getMediaFile()));
}
};

View File

@ -24,7 +24,6 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.text.Format;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@ -447,7 +446,7 @@ public class FormatDialog extends JDialog {
media = new File(path);
}
return new MediaBindingBean(info, media, Collections.singletonMap(media, info));
return new MediaBindingBean(info, media);
}
private ExecutorService createExecutor() {
@ -642,7 +641,7 @@ public class FormatDialog extends JDialog {
File file = dialog.getMediaFile();
// change sample
sample = new MediaBindingBean(info, file, Collections.singletonMap(file, info));
sample = new MediaBindingBean(info, file);
// remember sample
try {