X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneRescuer.java;h=60451274548b77f5b6ace075db02aba46a01ea44;hb=b7f0567e2a3e88f2327dfdb045a1b0e4bca9dcac;hp=4d706ca04b36c578af705f30b70646252fa7cc1a;hpb=a6486d6aab8e425cc235ac41f8159602ebdb8e3a;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java index 4d706ca..6045127 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java @@ -108,17 +108,6 @@ public class SoneRescuer extends AbstractService { } /** - * Sets the edition to rescue. - * - * @param edition - * The edition to rescue - * @return This Sone rescuer - */ - public void setEdition(long edition) { - currentEdition = edition; - } - - /** * Sets whether the last fetch was successful. * * @return {@code true} if the last fetch was successful, {@code false} @@ -134,15 +123,22 @@ public class SoneRescuer extends AbstractService { // /** - * Starts the next fetch. If you want to fetch a different edition than “the - * next older one,” remember to call {@link #setEdition(long)} before - * calling this method. + * Starts the next fetch. */ public void startNextFetch() { fetching = true; notifySyncObject(); } + /** + * Starts the next fetch. + */ + public void startNextFetchWithSkip() { + currentEdition--; + fetching = true; + notifySyncObject(); + } + // // SERVICE METHODS // @@ -158,13 +154,14 @@ public class SoneRescuer extends AbstractService { } if (fetching) { core.lockSone(sone); - FreenetURI soneUri = sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + currentEdition).setMetaString(new String[] { "sone.xml" }); + FreenetURI soneUri = sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + getNextEdition()).setMetaString(new String[] { "sone.xml" }); System.out.println("URI: " + soneUri); Sone fetchedSone = soneDownloader.fetchSone(sone, soneUri, true); System.out.println("Sone: " + fetchedSone); lastFetchSuccessful = (fetchedSone != null); if (lastFetchSuccessful) { core.updateSone(fetchedSone, true); + currentEdition = getNextEdition(); } fetching = false; }