* set xattr only for episode/movie files
This commit is contained in:
parent
61bd6f1d9e
commit
59a2dbaf27
|
@ -836,37 +836,36 @@ public class MediaDetection {
|
||||||
|
|
||||||
|
|
||||||
public static void storeMetaInfo(File file, Object model) {
|
public static void storeMetaInfo(File file, Object model) {
|
||||||
MetaAttributes xattr = new MetaAttributes(file);
|
// only for Episode / Movie objects
|
||||||
|
if (model instanceof Episode || model instanceof Movie) {
|
||||||
// store original name and model as xattr
|
MetaAttributes xattr = new MetaAttributes(file);
|
||||||
try {
|
|
||||||
if (model instanceof Episode || model instanceof Movie) {
|
// store original name and model as xattr
|
||||||
xattr.setMetaData(model);
|
try {
|
||||||
|
|
||||||
if (xattr.getOriginalName() == null) {
|
if (xattr.getOriginalName() == null) {
|
||||||
xattr.setOriginalName(file.getName());
|
xattr.setOriginalName(file.getName());
|
||||||
}
|
}
|
||||||
|
xattr.setMetaData(model);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set xattr: " + e.getMessage());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set xattr: " + e.getMessage());
|
// set creation date to episode / movie release date
|
||||||
}
|
try {
|
||||||
|
if (model instanceof Episode) {
|
||||||
// set creation date to episode / movie release date
|
Episode episode = (Episode) model;
|
||||||
try {
|
if (episode.airdate() != null) {
|
||||||
if (model instanceof Episode) {
|
xattr.setCreationDate(episode.airdate().getTimeStamp());
|
||||||
Episode episode = (Episode) model;
|
}
|
||||||
if (episode.airdate() != null) {
|
} else if (model instanceof Movie) {
|
||||||
xattr.setCreationDate(episode.airdate().getTimeStamp());
|
Movie movie = (Movie) model;
|
||||||
}
|
if (movie.getYear() > 0) {
|
||||||
} else if (model instanceof Movie) {
|
xattr.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp());
|
||||||
Movie movie = (Movie) model;
|
}
|
||||||
if (movie.getYear() > 0) {
|
|
||||||
xattr.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp());
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set creation date: " + e.getMessage());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set creation date: " + e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue