Fixes, new version number: 0.9.2
[fanfix.git] / src / be / nikiroo / fanfix / Library.java
index 304f19f462e1a05a899e4b01de430e6c283abfef..abe760b0d24e31862764093be7bdbcf0b670ce0d 100644 (file)
@@ -75,6 +75,26 @@ public class Library {
                return list;
        }
 
+       /**
+        * Retrieve a {@link File} corresponding to the given {@link Story}.
+        * 
+        * @param luid
+        *            the Library UID of the story
+        * 
+        * @return the corresponding {@link Story}
+        */
+       public MetaData getInfo(String luid) {
+               if (luid != null) {
+                       for (Entry<MetaData, File> entry : getStories().entrySet()) {
+                               if (luid.equals(entry.getKey().getLuid())) {
+                                       return entry.getKey();
+                               }
+                       }
+               }
+
+               return null;
+       }
+
        /**
         * Retrieve a {@link File} corresponding to the given {@link Story}.
         * 
@@ -207,7 +227,7 @@ public class Library {
         *             in case of I/O error
         */
        private Story save(Story story, String luid) throws IOException {
-               MetaData key = story.getMeta();
+               MetaData key = story.getMeta().clone();
 
                if (luid == null || luid.isEmpty()) {
                        getStories(); // refresh lastId if needed