From 94ceccf96643138b7b6dd0eb6b2fed7e3b998c37 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 8 Jan 2014 20:52:28 +0000 Subject: [PATCH] * fix original name xattr --- source/net/sourceforge/filebot/cli/CmdlineOperations.java | 2 +- source/net/sourceforge/filebot/media/MediaDetection.java | 6 +++--- source/net/sourceforge/filebot/ui/rename/RenameAction.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 1d32edc4..a96ce442 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -614,7 +614,7 @@ public class CmdlineOperations implements CmdlineInterface { if (renameMap.containsKey(file) && meta != null) { File destination = resolveDestination(file, renameMap.get(file), false); if (destination.isFile()) { - MediaDetection.storeMetaInfo(destination, meta); + MediaDetection.storeMetaInfo(destination, meta, file.getName()); } } } diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index c2a05339..095a0c13 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -1249,7 +1249,7 @@ public class MediaDetection { } } - public static void storeMetaInfo(File file, Object model) { + public static void storeMetaInfo(File file, Object model, String original) { // only for Episode / Movie objects if ((model instanceof Episode || model instanceof Movie) && file.exists()) { try { @@ -1275,8 +1275,8 @@ public class MediaDetection { // store original name and model as xattr try { xattr.setObject(model); - if (xattr.getOriginalName() == null) { - xattr.setOriginalName(file.getName()); + if (xattr.getOriginalName() == null && original != null) { + xattr.setOriginalName(original); } } catch (Exception e) { Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set xattr: " + e.getMessage()); diff --git a/source/net/sourceforge/filebot/ui/rename/RenameAction.java b/source/net/sourceforge/filebot/ui/rename/RenameAction.java index 86223011..688a4f65 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenameAction.java +++ b/source/net/sourceforge/filebot/ui/rename/RenameAction.java @@ -123,7 +123,7 @@ class RenameAction extends AbstractAction { if (renameMap.containsKey(file) && meta != null) { File destination = resolveDestination(file, renameMap.get(file), false); if (destination.isFile()) { - MediaDetection.storeMetaInfo(destination, meta); + MediaDetection.storeMetaInfo(destination, meta, file.getName()); } } }