git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e64228f
)
remote/general: import should not retrieve story from server
author
Niki Roo
<niki@nikiroo.be>
Thu, 19 Sep 2019 11:15:30 +0000
(13:15 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 19 Sep 2019 11:15:30 +0000
(13:15 +0200)
src/be/nikiroo/fanfix/Main.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/library/BasicLibrary.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/library/CacheLibrary.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/library/RemoteLibrary.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix/Main.java
b/src/be/nikiroo/fanfix/Main.java
index b3633612713996f8651bffda5f480fc2607b54be..3d69cad31358f794d874b0645a9e124e36bf7caa 100644
(file)
--- a/
src/be/nikiroo/fanfix/Main.java
+++ b/
src/be/nikiroo/fanfix/Main.java
@@
-12,6
+12,7
@@
import javax.net.ssl.SSLException;
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.bundles.StringId;
import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.bundles.StringId;
import be.nikiroo.fanfix.data.Chapter;
+import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.library.BasicLibrary;
import be.nikiroo.fanfix.library.CacheLibrary;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.library.BasicLibrary;
import be.nikiroo.fanfix.library.CacheLibrary;
@@
-644,10
+645,10
@@
public class Main {
*/
public static int imprt(String urlString, Progress pg) {
try {
*/
public static int imprt(String urlString, Progress pg) {
try {
-
Story story
= Instance.getLibrary().imprt(
+
MetaData meta
= Instance.getLibrary().imprt(
BasicReader.getUrl(urlString), pg);
BasicReader.getUrl(urlString), pg);
- System.out.println(
story.getMeta().getLuid() + ": \""
- +
story.getMeta().getTitle() +
"\" imported.");
+ System.out.println(
meta.getLuid() + ": \"" + meta.getTitle()
+ + "\" imported.");
} catch (IOException e) {
Instance.getTraceHandler().error(e);
return 1;
} catch (IOException e) {
Instance.getTraceHandler().error(e);
return 1;
diff --git
a/src/be/nikiroo/fanfix/library/BasicLibrary.java
b/src/be/nikiroo/fanfix/library/BasicLibrary.java
index 380c5c988ca43dad853f7e4edb25e657a55ed1ba..099859dcfaffed075f30b3d716b790f644a43a09 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/BasicLibrary.java
+++ b/
src/be/nikiroo/fanfix/library/BasicLibrary.java
@@
-751,14
+751,14
@@
abstract public class BasicLibrary {
* @param pg
* the optional progress reporter
*
* @param pg
* the optional progress reporter
*
- * @return the imported
{@link Story
}
+ * @return the imported
Story {@link MetaData
}
*
* @throws UnknownHostException
* if the host is not supported
* @throws IOException
* in case of I/O error
*/
*
* @throws UnknownHostException
* if the host is not supported
* @throws IOException
* in case of I/O error
*/
- public
Story
imprt(URL url, Progress pg) throws IOException {
+ public
MetaData
imprt(URL url, Progress pg) throws IOException {
if (pg == null)
pg = new Progress();
if (pg == null)
pg = new Progress();
@@
-776,7
+776,7
@@
abstract public class BasicLibrary {
Story story = save(support.process(pgProcess), pgSave);
pg.done();
Story story = save(support.process(pgProcess), pgSave);
pg.done();
- return story;
+ return story
.getMeta()
;
}
/**
}
/**
diff --git
a/src/be/nikiroo/fanfix/library/CacheLibrary.java
b/src/be/nikiroo/fanfix/library/CacheLibrary.java
index 019acd210d1fb3b2263db468e2c21e6e6bfd1d69..e128da525b6616befc61a5917119a3e70f1e2b26 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/CacheLibrary.java
+++ b/
src/be/nikiroo/fanfix/library/CacheLibrary.java
@@
-345,7
+345,7
@@
public class CacheLibrary extends BasicLibrary {
}
@Override
}
@Override
- public
Story
imprt(URL url, Progress pg) throws IOException {
+ public
MetaData
imprt(URL url, Progress pg) throws IOException {
if (pg == null) {
pg = new Progress();
}
if (pg == null) {
pg = new Progress();
}
@@
-356,13
+356,13
@@
public class CacheLibrary extends BasicLibrary {
pg.addProgress(pgImprt, 7);
pg.addProgress(pgCache, 3);
pg.addProgress(pgImprt, 7);
pg.addProgress(pgCache, 3);
-
Story story
= lib.imprt(url, pgImprt);
-
cacheLib.save(story, story.getMeta().getLuid(), pgCache
);
-
-
updateInfo(story.getMeta
());
+
MetaData meta
= lib.imprt(url, pgImprt);
+
updateInfo(meta
);
+
+
clearFromCache(meta.getLuid
());
pg.done();
pg.done();
- return
story
;
+ return
meta
;
}
// All the following methods are only used by Save and Delete in
}
// All the following methods are only used by Save and Delete in
diff --git
a/src/be/nikiroo/fanfix/library/RemoteLibrary.java
b/src/be/nikiroo/fanfix/library/RemoteLibrary.java
index a6c68546882c0cdd64bda6c7592976d228bdfb4d..ce4305aadad96bfe9446817d467234545ccfce7a 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/RemoteLibrary.java
+++ b/
src/be/nikiroo/fanfix/library/RemoteLibrary.java
@@
-78,7
+78,7
@@
public class RemoteLibrary extends BasicLibrary {
* <li><b>wl</b>: flag to allow access to all the stories (bypassing the
* whitelist if it exists)</li>
* </ul>
* <li><b>wl</b>: flag to allow access to all the stories (bypassing the
* whitelist if it exists)</li>
* </ul>
- *
+ *
<p>
* Some examples:
* <ul>
* <li><b>my_key</b>: normal connection, will take the default server
* Some examples:
* <ul>
* <li><b>my_key</b>: normal connection, will take the default server
@@
-352,8
+352,9
@@
public class RemoteLibrary extends BasicLibrary {
@Override
// Could work (more slowly) without it
@Override
// Could work (more slowly) without it
- public
Story
imprt(final URL url, Progress pg) throws IOException {
+ public
MetaData
imprt(final URL url, Progress pg) throws IOException {
// Import the file locally if it is actually a file
// Import the file locally if it is actually a file
+
if (url == null || url.getProtocol().equalsIgnoreCase("file")) {
return super.imprt(url, pg);
}
if (url == null || url.getProtocol().equalsIgnoreCase("file")) {
return super.imprt(url, pg);
}
@@
-364,13
+365,7
@@
public class RemoteLibrary extends BasicLibrary {
pg = new Progress();
}
pg = new Progress();
}
- pg.setMinMax(0, 2);
- Progress pgImprt = new Progress();
- Progress pgGet = new Progress();
- pg.addProgress(pgImprt, 1);
- pg.addProgress(pgGet, 1);
-
- final Progress pgF = pgImprt;
+ final Progress pgF = pg;
final String[] luid = new String[1];
connectRemoteAction(new RemoteAction() {
final String[] luid = new String[1];
connectRemoteAction(new RemoteAction() {
@@
-399,11
+394,8
@@
public class RemoteLibrary extends BasicLibrary {
throw new IOException("Remote failure");
}
throw new IOException("Remote failure");
}
- Story story = getStory(luid[0], pgGet);
- pgGet.done();
-
pg.done();
pg.done();
- return
story
;
+ return
getInfo(luid[0])
;
}
@Override
}
@Override
diff --git
a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
index 43f61b096cbb6e8d452a47b13853a1a2fc15af7c..dc9688c4de69c0348a1ee7dbac4665ec581d905a 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
+++ b/
src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
@@
-289,10
+289,10
@@
public class RemoteLibraryServer extends ServerObject {
}
Progress pg = createPgForwarder(action);
}
Progress pg = createPgForwarder(action);
-
Story story
= Instance.getLibrary().imprt(
+
MetaData meta
= Instance.getLibrary().imprt(
new URL((String) args[0]), pg);
forcePgDoneSent(pg);
new URL((String) args[0]), pg);
forcePgDoneSent(pg);
- return
story.getMeta()
.getLuid();
+ return
meta
.getLuid();
} else if ("DELETE_STORY".equals(command)) {
if (!rw) {
throw new RemoteLibraryException("Read-Only remote library: "
} else if ("DELETE_STORY".equals(command)) {
if (!rw) {
throw new RemoteLibraryException("Read-Only remote library: "
diff --git
a/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java
b/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java
index a28dc8a0d275bda522b46f2a96d860907ba40f37..fe11c810edf76b8e4a79d066460dfd123c8a71e9 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java
+++ b/
src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java
@@
-36,7
+36,7
@@
import be.nikiroo.fanfix.library.LocalLibrary;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.fanfix.reader.BasicReader;
import be.nikiroo.fanfix.reader.ui.GuiReaderMainPanel.FrameHelper;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.fanfix.reader.BasicReader;
import be.nikiroo.fanfix.reader.ui.GuiReaderMainPanel.FrameHelper;
-import be.nikiroo.fanfix.reader.ui.GuiReaderMainPanel.
Story
Runnable;
+import be.nikiroo.fanfix.reader.ui.GuiReaderMainPanel.
MetaData
Runnable;
import be.nikiroo.fanfix.searchable.BasicSearchable;
import be.nikiroo.fanfix.supported.SupportType;
import be.nikiroo.utils.Progress;
import be.nikiroo.fanfix.searchable.BasicSearchable;
import be.nikiroo.fanfix.supported.SupportType;
import be.nikiroo.utils.Progress;
@@
-756,10
+756,9
@@
class GuiReaderFrame extends JFrame implements FrameHelper {
final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
final MetaData meta = selectedBook.getInfo().getMeta();
final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
final MetaData meta = selectedBook.getInfo().getMeta();
- mainPanel.imprt(meta.getUrl(), new
Story
Runnable() {
+ mainPanel.imprt(meta.getUrl(), new
MetaData
Runnable() {
@Override
@Override
- public void run(Story story) {
- MetaData newMeta = story.getMeta();
+ public void run(MetaData newMeta) {
if (!newMeta.getSource().equals(meta.getSource())) {
reader.changeSource(newMeta.getLuid(),
meta.getSource());
if (!newMeta.getSource().equals(meta.getSource())) {
reader.changeSource(newMeta.getLuid(),
meta.getSource());
diff --git
a/src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java
b/src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java
index 8593fe6471c816812220defeedf5775fe1757642..7caa243c411ca4bba0f4bf2c0dbbedd7368f8e07 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java
+++ b/
src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java
@@
-108,18
+108,18
@@
class GuiReaderMainPanel extends JPanel {
}
/**
}
/**
- * A {@link Runnable} with a {@link
Story
} parameter.
+ * A {@link Runnable} with a {@link
MetaData
} parameter.
*
* @author niki
*/
*
* @author niki
*/
- public interface
Story
Runnable {
+ public interface
MetaData
Runnable {
/**
* Run the action.
*
/**
* Run the action.
*
- * @param
story
- * the story
+ * @param
meta
+ * the
meta of the
story
*/
*/
- public void run(
Story story
);
+ public void run(
MetaData meta
);
}
/**
}
/**
@@
-548,7
+548,7
@@
class GuiReaderMainPanel extends JPanel {
* @param onSuccessPgName
* the name to use for the onSuccess progress bar
*/
* @param onSuccessPgName
* the name to use for the onSuccess progress bar
*/
- public void imprt(final String url, final
Story
Runnable onSuccess,
+ public void imprt(final String url, final
MetaData
Runnable onSuccess,
String onSuccessPgName) {
final Progress pg = new Progress();
final Progress pgImprt = new Progress();
String onSuccessPgName) {
final Progress pg = new Progress();
final Progress pgImprt = new Progress();
@@
-560,9
+560,9
@@
class GuiReaderMainPanel extends JPanel {
@Override
public void run() {
Exception ex = null;
@Override
public void run() {
Exception ex = null;
-
Story story
= null;
+
MetaData meta
= null;
try {
try {
-
story
= helper.getReader().getLibrary()
+
meta
= helper.getReader().getLibrary()
.imprt(BasicReader.getUrl(url), pgImprt);
} catch (IOException e) {
ex = e;
.imprt(BasicReader.getUrl(url), pgImprt);
} catch (IOException e) {
ex = e;
@@
-586,7
+586,7
@@
class GuiReaderMainPanel extends JPanel {
}
} else {
if (onSuccess != null) {
}
} else {
if (onSuccess != null) {
- onSuccess.run(
story
);
+ onSuccess.run(
meta
);
}
}
pgOnSuccess.done();
}
}
pgOnSuccess.done();