This commit is contained in:
Reinhard Pointner 2016-04-27 01:44:21 +08:00
parent 30b79710e3
commit 2cb0d355a6
1 changed files with 7 additions and 17 deletions

View File

@ -909,19 +909,14 @@ public class MediaBindingBean {
@Define("defines") @Define("defines")
public Map<String, String> getUserDefinedArguments() throws IOException { public Map<String, String> getUserDefinedArguments() throws IOException {
return Settings.getApplicationArguments().defines; return unmodifiableMap(Settings.getApplicationArguments().defines);
} }
@Define("label") @Define("label")
public String getUserDefinedLabel() throws IOException { public String getUserDefinedLabel() throws IOException {
for (Entry<String, String> it : getUserDefinedArguments().entrySet()) { return getUserDefinedArguments().entrySet().stream().filter(it -> {
if (it.getKey().endsWith("label")) { return it.getKey().endsWith("label") && it.getValue() != null && it.getValue().length() > 0;
if (it.getValue() != null && it.getValue().length() > 0) { }).map(it -> it.getValue()).findFirst().orElse(null);
return it.getValue();
}
}
}
return null;
} }
@Define("i") @Define("i")
@ -931,13 +926,7 @@ public class MediaBindingBean {
@Define("di") @Define("di")
public Integer getDuplicateIndex() { public Integer getDuplicateIndex() {
List<Object> duplicates = new ArrayList<Object>(); return 1 + identityIndexOf(context.values().stream().filter(it -> getInfoObject().equals(it)).collect(toList()), getInfoObject());
for (Object it : context.values()) {
if (getInfoObject().equals(it)) {
duplicates.add(it);
}
}
return 1 + identityIndexOf(duplicates, getInfoObject());
} }
@Define("plex") @Define("plex")
@ -1034,8 +1023,9 @@ public class MediaBindingBean {
Iterator<?> itr = c.iterator(); Iterator<?> itr = c.iterator();
for (int i = 0; itr.hasNext(); i++) { for (int i = 0; itr.hasNext(); i++) {
Object next = itr.next(); Object next = itr.next();
if (o == next) if (o == next) {
return i; return i;
}
} }
return null; return null;
} }