X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=b11e1ec5276324743b2ea64fb0697d616567c7d4;hp=328ef656e444fbe4686dca82e08fafa204590d0d;hb=ff05b8284e6e415b13d3543650075d0f7cd27ff5;hpb=e604986c4208da0091d26bc0e1c4feb4ff3c588f diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 328ef65..b11e1ec 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -48,10 +48,12 @@ abstract public class BasicLibrary { * * @param luid * the Library UID of the story + * @param pg + * the optional {@link Progress} * * @return the corresponding {@link Story} */ - public abstract File getFile(String luid); + public abstract File getFile(String luid, Progress pg); /** * Return the cover image associated to this story. @@ -294,21 +296,29 @@ abstract public class BasicLibrary { * @return the corresponding {@link Story} or NULL if not found */ public synchronized Story getStory(String luid, Progress pg) { - // TODO: pg if (pg == null) { pg = new Progress(); } + Progress pgGet = new Progress(); + Progress pgProcess = new Progress(); + + pg.setMinMax(0, 2); + pg.addProgress(pgGet, 1); + pg.addProgress(pgProcess, 1); + Story story = null; for (MetaData meta : getMetas(null)) { if (meta.getLuid().equals(luid)) { - File file = getFile(luid); + File file = getFile(luid, pgGet); + pgGet.done(); try { SupportType type = SupportType.valueOfAllOkUC(meta .getType()); URL url = file.toURI().toURL(); if (type != null) { - story = BasicSupport.getSupport(type).process(url, pg); + story = BasicSupport.getSupport(type).process(url, + pgProcess); } else { throw new IOException("Unknown type: " + meta.getType()); } @@ -318,6 +328,7 @@ abstract public class BasicLibrary { Instance.syserr(new IOException( "Cannot load file from library: " + file, e)); } finally { + pgProcess.done(); pg.done(); }