Minor optimizations

This commit is contained in:
Reinhard Pointner 2016-10-08 23:56:47 +08:00
parent 5ca51e1d7d
commit 8ee1b06b3a
1 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package net.filebot.media;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
@ -15,10 +16,12 @@ import net.filebot.Cache;
import net.filebot.CacheType;
import net.filebot.Resource;
import net.filebot.WebServices;
import net.filebot.vfs.SimpleFileInfo;
import net.filebot.web.AudioTrack;
import net.filebot.web.Episode;
import net.filebot.web.Movie;
import net.filebot.web.MoviePart;
import net.filebot.web.MultiEpisode;
import net.filebot.web.SimpleDate;
public class XattrMetaInfo {
@ -31,7 +34,7 @@ public class XattrMetaInfo {
private final Cache xattrMetaInfoCache = Cache.getCache(MetaAttributes.METADATA_KEY, CacheType.Ephemeral);
private final Cache xattrOriginalNameCache = Cache.getCache(MetaAttributes.FILENAME_KEY, CacheType.Ephemeral);
private final Map<String, String> jsonTypeMap = Stream.of(Episode.class, Movie.class, MoviePart.class, AudioTrack.class).collect(toMap(Class::getName, Class::getSimpleName));
private final Map<String, String> jsonTypeMap = unmodifiableMap(Stream.of(Episode.class, MultiEpisode.class, Movie.class, MoviePart.class, AudioTrack.class, SimpleFileInfo.class).collect(toMap(Class::getName, Class::getSimpleName)));
public XattrMetaInfo(boolean useExtendedFileAttributes, boolean useCreationDate) {
this.useExtendedFileAttributes = useExtendedFileAttributes;
@ -83,7 +86,11 @@ public class XattrMetaInfo {
}
private MetaAttributes xattr(File file) throws Exception {
return new MetaAttributes(file, jsonTypeMap);
return new MetaAttributes(file, getJsonTypeMap());
}
public Map<String, String> getJsonTypeMap() {
return jsonTypeMap;
}
public synchronized void setMetaInfo(File file, Object model, String original) {