X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=7f286079ed1fe87c88f2ec798a85c26774950089;hb=fedd641e30e8b31d1aeb953a913ba536efd8d813;hp=c6ce22dd24c1c4fa85f60edfdcea7bd5f8de1b05;hpb=4452446c58411c3f8e13f1fb5c3eecd0e9140d15;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index c6ce22d..7f28607 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -149,7 +149,7 @@ abstract public class BasicLibrary { return custom; } - List metas = getListBySource(source); + List metas = getList().filter(source, null, null); if (metas.size() > 0) { return getCover(metas.get(0).getLuid()); } @@ -177,7 +177,7 @@ abstract public class BasicLibrary { return custom; } - List metas = getListByAuthor(author); + List metas = getList().filter(null, author, null); if (metas.size() > 0) { return getCover(metas.get(0).getLuid()); } @@ -338,7 +338,7 @@ abstract public class BasicLibrary { * @param pg * the optional progress reporter */ - public void refresh(Progress pg) { + public synchronized void refresh(Progress pg) { try { getMetas(pg); } catch (IOException e) { @@ -597,49 +597,8 @@ abstract public class BasicLibrary { * @throws IOException * in case of IOException */ - public synchronized List getList() throws IOException { - return getMetas(null); - } - - /** - * List all the stories of the given source type in the {@link BasicLibrary} , - * or all the stories if NULL is passed as a type. - *

- * Cover images not included. - * - * @param source the type of story to retrieve, or NULL for all - * - * @return the stories - * - * @throws IOException in case of IOException - * - * @deprecated use {@link BasicLibrary#getList(Progress)} and - * {@link MetaResultList#filter(String, String, String)} - */ - @Deprecated - public synchronized List getListBySource(String source) throws IOException { - return getList(null).filter(source, null, null); - } - - /** - * List all the stories of the given author in the {@link BasicLibrary}, or - * all the stories if NULL is passed as an author. - *

- * Cover images not included. - * - * @param author - * the author of the stories to retrieve, or NULL for all - * - * @return the stories - * - * @throws IOException - * in case of IOException - * - * @deprecated use {@link BasicLibrary#getList(Progress)} and - * {@link MetaResultList#filter(String, String, String)} - */ - public synchronized List getListByAuthor(String author) throws IOException { - return getList(null).filter(null, author, null); + public MetaResultList getList() throws IOException { + return getList(null); } /** @@ -796,6 +755,7 @@ abstract public class BasicLibrary { } Story story = save(support.process(pgProcess), pgSave); + pg.setName(story.getMeta().getTitle()); pg.done(); return story.getMeta(); @@ -913,13 +873,18 @@ abstract public class BasicLibrary { */ public synchronized Story save(Story story, String luid, Progress pg) throws IOException { - + if (pg == null) { + pg = new Progress(); + } + Instance.getInstance().getTraceHandler().trace(this.getClass().getSimpleName() + ": saving story " + luid); // Do not change the original metadata, but change the original story MetaData meta = story.getMeta().clone(); story.setMeta(meta); + pg.setName("Saving story"); + if (luid == null || luid.isEmpty()) { meta.setLuid(String.format("%03d", getNextId())); } else { @@ -937,6 +902,8 @@ abstract public class BasicLibrary { Instance.getInstance().getTraceHandler() .trace(this.getClass().getSimpleName() + ": story saved (" + luid + ")"); + pg.setName(meta.getTitle()); + pg.done(); return story; } @@ -1058,8 +1025,6 @@ abstract public class BasicLibrary { meta.setTitle(newTitle); meta.setAuthor(newAuthor); saveMeta(meta, pg); - - invalidateInfo(luid); } /**