Search in sources :

Example 1 with RipStatusMessage

use of com.rarchives.ripme.ui.RipStatusMessage in project ripme by RipMeApp.

the class AbstractHTMLRipper method downloadErrored.

@Override
public /**
 * Cleans up & tells user about failed download.
 */
void downloadErrored(URL url, String reason) {
    if (observer == null) {
        return;
    }
    itemsPending.remove(url);
    itemsErrored.put(url, reason);
    observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_ERRORED, url + " : " + reason));
    checkIfComplete();
}
Also used : RipStatusMessage(com.rarchives.ripme.ui.RipStatusMessage)

Example 2 with RipStatusMessage

use of com.rarchives.ripme.ui.RipStatusMessage in project ripme by RipMeApp.

the class AbstractHTMLRipper method downloadCompleted.

@Override
public /**
 * Cleans up & tells user about successful download
 */
void downloadCompleted(URL url, File saveAs) {
    if (observer == null) {
        return;
    }
    try {
        String path = Utils.removeCWD(saveAs);
        RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, path);
        itemsPending.remove(url);
        itemsCompleted.put(url, saveAs);
        observer.update(this, msg);
        checkIfComplete();
    } catch (Exception e) {
        LOGGER.error("Exception while updating observer: ", e);
    }
}
Also used : RipStatusMessage(com.rarchives.ripme.ui.RipStatusMessage) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Example 3 with RipStatusMessage

use of com.rarchives.ripme.ui.RipStatusMessage in project ripme by RipMeApp.

the class AbstractJSONRipper method downloadExists.

@Override
public /**
 * Tells user that a single file in the album they wish to download has
 * already been downloaded in the past.
 */
void downloadExists(URL url, File file) {
    if (observer == null) {
        return;
    }
    itemsPending.remove(url);
    itemsCompleted.put(url, file);
    observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_WARN, url + " already saved as " + file.getAbsolutePath()));
    checkIfComplete();
}
Also used : RipStatusMessage(com.rarchives.ripme.ui.RipStatusMessage)

Example 4 with RipStatusMessage

use of com.rarchives.ripme.ui.RipStatusMessage in project ripme by RipMeApp.

the class AbstractJSONRipper method downloadErrored.

@Override
public /**
 * Cleans up & tells user about failed download.
 */
void downloadErrored(URL url, String reason) {
    if (observer == null) {
        return;
    }
    itemsPending.remove(url);
    itemsErrored.put(url, reason);
    observer.update(this, new RipStatusMessage(STATUS.DOWNLOAD_ERRORED, url + " : " + reason));
    checkIfComplete();
}
Also used : RipStatusMessage(com.rarchives.ripme.ui.RipStatusMessage)

Example 5 with RipStatusMessage

use of com.rarchives.ripme.ui.RipStatusMessage in project ripme by RipMeApp.

the class AbstractJSONRipper method downloadCompleted.

@Override
public /**
 * Cleans up & tells user about successful download
 */
void downloadCompleted(URL url, File saveAs) {
    if (observer == null) {
        return;
    }
    try {
        String path = Utils.removeCWD(saveAs);
        RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, path);
        itemsPending.remove(url);
        itemsCompleted.put(url, saveAs);
        observer.update(this, msg);
        checkIfComplete();
    } catch (Exception e) {
        LOGGER.error("Exception while updating observer: ", e);
    }
}
Also used : RipStatusMessage(com.rarchives.ripme.ui.RipStatusMessage) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Aggregations

RipStatusMessage (com.rarchives.ripme.ui.RipStatusMessage)16 IOException (java.io.IOException)7 MalformedURLException (java.net.MalformedURLException)4 File (java.io.File)2 FileWriter (java.io.FileWriter)2 RipStatusComplete (com.rarchives.ripme.ui.RipStatusComplete)1 FileAppender (org.apache.log4j.FileAppender)1 Logger (org.apache.log4j.Logger)1