X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=f77d0edcef5ae64b186942be2a6048fa7eca7745;hb=34f8780d16faf3a5466c45261bd84f1b31516790;hp=11ca03f48a7bdc912766968f2ac96168a5f2f38c;hpb=5ee0fc14dbffa8d11b914537d957ef892ba20ef9;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 11ca03f..f77d0ed 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -43,7 +43,9 @@ abstract public class BasicLibrary { READ_ONLY, /** You are not allowed to access this library. */ UNAUTHORIZED, - /** The library is currently out of commission. */ + /** The library is invalid, and will never work as is. */ + INVALID, + /** The library is currently out of commission, but may work later. */ UNAVAILABLE; /** @@ -309,7 +311,7 @@ abstract public class BasicLibrary { * * @return the next luid */ - protected abstract int getNextId(); + protected abstract String getNextId(); /** * Delete the target {@link Story}. @@ -473,6 +475,8 @@ abstract public class BasicLibrary { /** * Retrieve a specific {@link Story}. + *

+ * Note that it will update both the cover and the resume in meta. * * @param luid * the Library UID of the story @@ -511,6 +515,8 @@ abstract public class BasicLibrary { /** * Retrieve a specific {@link Story}. + *

+ * Note that it will update both the cover and the resume in meta. * * @param luid * the LUID of the story @@ -593,6 +599,28 @@ abstract public class BasicLibrary { * in case of I/O error */ public MetaData imprt(URL url, Progress pg) throws IOException { + return imprt(url, null, pg); + } + + /** + * Import the {@link Story} at the given {@link URL} into the + * {@link BasicLibrary}. + * + * @param url + * the {@link URL} to import + * @param luid + * the LUID to use + * @param pg + * the optional progress reporter + * + * @return the imported Story {@link MetaData} + * + * @throws UnknownHostException + * if the host is not supported + * @throws IOException + * in case of I/O error + */ + MetaData imprt(URL url, String luid, Progress pg) throws IOException { if (pg == null) pg = new Progress(); @@ -607,7 +635,7 @@ abstract public class BasicLibrary { throw new UnknownHostException("" + url); } - Story story = save(support.process(pgProcess), pgSave); + Story story = save(support.process(pgProcess), luid, pgSave); pg.done(); return story.getMeta(); @@ -739,7 +767,7 @@ abstract public class BasicLibrary { pg.setName("Saving story"); if (luid == null || luid.isEmpty()) { - meta.setLuid(String.format("%03d", getNextId())); + meta.setLuid(getNextId()); } else { meta.setLuid(luid); }