From 59a2dbaf2742fd8eb9c4b727dec690012a70dd5d Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 15 Feb 2013 10:49:34 +0000 Subject: [PATCH] * set xattr only for episode/movie files --- .../filebot/media/MediaDetection.java | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index 87536b05..75de8ff1 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -836,37 +836,36 @@ public class MediaDetection { public static void storeMetaInfo(File file, Object model) { - MetaAttributes xattr = new MetaAttributes(file); - - // store original name and model as xattr - try { - if (model instanceof Episode || model instanceof Movie) { - xattr.setMetaData(model); - + // only for Episode / Movie objects + if (model instanceof Episode || model instanceof Movie) { + MetaAttributes xattr = new MetaAttributes(file); + + // store original name and model as xattr + try { if (xattr.getOriginalName() == null) { 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) { - Episode episode = (Episode) model; - if (episode.airdate() != null) { - xattr.setCreationDate(episode.airdate().getTimeStamp()); - } - } else if (model instanceof Movie) { - Movie movie = (Movie) model; - if (movie.getYear() > 0) { - xattr.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp()); + + // set creation date to episode / movie release date + try { + if (model instanceof Episode) { + Episode episode = (Episode) model; + if (episode.airdate() != null) { + xattr.setCreationDate(episode.airdate().getTimeStamp()); + } + } else if (model instanceof Movie) { + 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()); } } - }