X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2FLibrary.java;h=68f93c5385c66ea52c7f4bd2fd6d43eb8ed8bb3b;hp=304f19f462e1a05a899e4b01de430e6c283abfef;hb=a7d266e6616349169d03e93780fb656754089dd0;hpb=2206ef66ee00ad42d806f04a7b7ad6f8cb2d8828 diff --git a/src/be/nikiroo/fanfix/Library.java b/src/be/nikiroo/fanfix/Library.java index 304f19f..68f93c5 100644 --- a/src/be/nikiroo/fanfix/Library.java +++ b/src/be/nikiroo/fanfix/Library.java @@ -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 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,9 @@ public class Library { * in case of I/O error */ private Story save(Story story, String luid) throws IOException { - MetaData key = story.getMeta(); + // Do not change the original metadata, but change the original story + MetaData key = story.getMeta().clone(); + story.setMeta(key); if (luid == null || luid.isEmpty()) { getStories(); // refresh lastId if needed