X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FGuiReader.java;h=410e05e56f0cd3a05338c8d37f6633e488cbb075;hb=e604986c4208da0091d26bc0e1c4feb4ff3c588f;hp=73df7fb8f4a25f89c5cc45782eb3fec05ad6ca9a;hpb=77e28d38d47dbfcf29030ee388854d59df3ef1d0;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/GuiReader.java b/src/be/nikiroo/fanfix/reader/GuiReader.java index 73df7fb..410e05e 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/GuiReader.java @@ -18,7 +18,6 @@ import be.nikiroo.fanfix.bundles.UiConfig; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.library.LocalLibrary; -import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; import be.nikiroo.utils.ui.UIUtils; @@ -41,33 +40,9 @@ class GuiReader extends BasicReader { "Cannote create cache directory for local reader: " + dir); } - OutputType text = null; - OutputType images = null; - - try { - text = OutputType.valueOfNullOkUC(Instance.getUiConfig().getString( - UiConfig.NON_IMAGES_DOCUMENT_TYPE)); - if (text == null) { - text = OutputType.HTML; - } - - images = OutputType.valueOfNullOkUC(Instance.getUiConfig() - .getString(UiConfig.IMAGES_DOCUMENT_TYPE)); - if (images == null) { - images = OutputType.CBZ; - } - } catch (Exception e) { - UiConfig key = (text == null) ? UiConfig.NON_IMAGES_DOCUMENT_TYPE - : UiConfig.IMAGES_DOCUMENT_TYPE; - String value = Instance.getUiConfig().getString(key); - - throw new IOException( - String.format( - "The configuration option %s is not valid: %s", - key, value), e); - } - - localLibrary = new LocalLibrary(dir, text, images); + localLibrary = new LocalLibrary(dir, Instance.getUiConfig().getString( + UiConfig.GUI_NON_IMAGES_DOCUMENT_TYPE), Instance.getUiConfig() + .getString(UiConfig.GUI_IMAGES_DOCUMENT_TYPE), true); } @Override @@ -93,21 +68,8 @@ class GuiReader extends BasicReader { * in case of I/O error */ public void imprt(String luid, Progress pg) throws IOException { - Progress pgGetStory = new Progress(); - Progress pgSave = new Progress(); - if (pg != null) { - pg.setMax(2); - pg.addProgress(pgGetStory, 1); - pg.addProgress(pgSave, 1); - } - try { - Story story = getLibrary().getStory(luid, pgGetStory); - if (story != null) { - story = localLibrary.save(story, luid, pgSave); - } else { - throw new IOException("Cannot find story in Library: " + luid); - } + localLibrary.imprt(getLibrary(), luid, pg); } catch (IOException e) { throw new IOException( "Cannot import story from library to LocalReader library: "