mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-25 06:41:20 +02:00
Thread -> runnable
This commit is contained in:
@@ -24,7 +24,7 @@ import com.rarchives.ripme.utils.Utils;
|
|||||||
* Thread for downloading files. Includes retry logic, observer notifications,
|
* Thread for downloading files. Includes retry logic, observer notifications,
|
||||||
* and other goodies.
|
* and other goodies.
|
||||||
*/
|
*/
|
||||||
class DownloadFileThread extends Thread {
|
class DownloadFileThread implements Runnable {
|
||||||
private static final Logger logger = LogManager.getLogger(DownloadFileThread.class);
|
private static final Logger logger = LogManager.getLogger(DownloadFileThread.class);
|
||||||
|
|
||||||
private String referrer = "";
|
private String referrer = "";
|
||||||
|
@@ -35,10 +35,10 @@ public class DownloadThreadPool {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* For adding threads to execution pool.
|
* For adding threads to execution pool.
|
||||||
* @param t
|
* @param t
|
||||||
* Thread to be added.
|
* Thread to be added.
|
||||||
*/
|
*/
|
||||||
public void addThread(Thread t) {
|
public void addThread(Runnable t) {
|
||||||
threadPool.execute(t);
|
threadPool.execute(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,15 +20,15 @@ import org.apache.logging.log4j.Logger;
|
|||||||
* Thread for downloading files.
|
* Thread for downloading files.
|
||||||
* Includes retry logic, observer notifications, and other goodies.
|
* Includes retry logic, observer notifications, and other goodies.
|
||||||
*/
|
*/
|
||||||
class DownloadVideoThread extends Thread {
|
class DownloadVideoThread implements Runnable {
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(DownloadVideoThread.class);
|
private static final Logger logger = LogManager.getLogger(DownloadVideoThread.class);
|
||||||
|
|
||||||
private URL url;
|
private final URL url;
|
||||||
private Path saveAs;
|
private final Path saveAs;
|
||||||
private String prettySaveAs;
|
private final String prettySaveAs;
|
||||||
private AbstractRipper observer;
|
private final AbstractRipper observer;
|
||||||
private int retries;
|
private final int retries;
|
||||||
|
|
||||||
public DownloadVideoThread(URL url, Path saveAs, AbstractRipper observer) {
|
public DownloadVideoThread(URL url, Path saveAs, AbstractRipper observer) {
|
||||||
super();
|
super();
|
||||||
@@ -43,6 +43,7 @@ class DownloadVideoThread extends Thread {
|
|||||||
* Attempts to download the file. Retries as needed.
|
* Attempts to download the file. Retries as needed.
|
||||||
* Notifies observers upon completion/error/warn.
|
* Notifies observers upon completion/error/warn.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
observer.stopCheck();
|
observer.stopCheck();
|
||||||
|
@@ -518,8 +518,8 @@ public class DeviantartRipper extends AbstractHTMLRipper {
|
|||||||
* @author MrPlaygon
|
* @author MrPlaygon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private class DeviantartImageThread extends Thread {
|
private class DeviantartImageThread implements Runnable {
|
||||||
private URL url;
|
private final URL url;
|
||||||
|
|
||||||
public DeviantartImageThread(URL url) {
|
public DeviantartImageThread(URL url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
@@ -193,10 +193,10 @@ public class E621Ripper extends AbstractHTMLRipper {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class E621FileThread extends Thread {
|
public class E621FileThread implements Runnable {
|
||||||
|
|
||||||
private URL url;
|
private final URL url;
|
||||||
private String index;
|
private final String index;
|
||||||
|
|
||||||
public E621FileThread(URL url, String index) {
|
public E621FileThread(URL url, String index) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
@@ -206,7 +206,7 @@ public class EHentaiRipper extends AbstractHTMLRipper {
|
|||||||
* <p>
|
* <p>
|
||||||
* Handles case when site has IP-banned the user.
|
* Handles case when site has IP-banned the user.
|
||||||
*/
|
*/
|
||||||
private class EHentaiImageThread extends Thread {
|
private class EHentaiImageThread implements Runnable {
|
||||||
private final URL url;
|
private final URL url;
|
||||||
private final int index;
|
private final int index;
|
||||||
private final Path workingDir;
|
private final Path workingDir;
|
||||||
|
@@ -84,7 +84,7 @@ public class HentaidudeRipper extends AbstractSingleFileRipper {
|
|||||||
return hentaidudeThreadPool;
|
return hentaidudeThreadPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HentaidudeDownloadThread extends Thread {
|
private class HentaidudeDownloadThread implements Runnable {
|
||||||
|
|
||||||
private URL url;
|
private URL url;
|
||||||
|
|
||||||
|
@@ -130,7 +130,7 @@ public class HqpornerRipper extends AbstractHTMLRipper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HqpornerDownloadThread extends Thread {
|
private class HqpornerDownloadThread implements Runnable {
|
||||||
|
|
||||||
private URL hqpornerVideoPageUrl;
|
private URL hqpornerVideoPageUrl;
|
||||||
//private int index;
|
//private int index;
|
||||||
|
@@ -117,9 +117,9 @@ public class ImagebamRipper extends AbstractHTMLRipper {
|
|||||||
*
|
*
|
||||||
* Handles case when site has IP-banned the user.
|
* Handles case when site has IP-banned the user.
|
||||||
*/
|
*/
|
||||||
private class ImagebamImageThread extends Thread {
|
private class ImagebamImageThread implements Runnable {
|
||||||
private URL url; //link to "image page"
|
private final URL url; //link to "image page"
|
||||||
private int index; //index in album
|
private final int index; //index in album
|
||||||
|
|
||||||
ImagebamImageThread(URL url, int index) {
|
ImagebamImageThread(URL url, int index) {
|
||||||
super();
|
super();
|
||||||
|
@@ -79,9 +79,9 @@ public class ImagevenueRipper extends AbstractHTMLRipper {
|
|||||||
*
|
*
|
||||||
* Handles case when site has IP-banned the user.
|
* Handles case when site has IP-banned the user.
|
||||||
*/
|
*/
|
||||||
private class ImagevenueImageThread extends Thread {
|
private class ImagevenueImageThread implements Runnable {
|
||||||
private URL url;
|
private final URL url;
|
||||||
private int index;
|
private final int index;
|
||||||
|
|
||||||
ImagevenueImageThread(URL url, int index) {
|
ImagevenueImageThread(URL url, int index) {
|
||||||
super();
|
super();
|
||||||
|
@@ -182,10 +182,10 @@ public class ListalRipper extends AbstractHTMLRipper {
|
|||||||
throw new MalformedURLException("Unable to fetch the gid for given url.");
|
throw new MalformedURLException("Unable to fetch the gid for given url.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ListalImageDownloadThread extends Thread {
|
private class ListalImageDownloadThread implements Runnable {
|
||||||
|
|
||||||
private URL url;
|
private final URL url;
|
||||||
private int index;
|
private final int index;
|
||||||
|
|
||||||
public ListalImageDownloadThread(URL url, int index) {
|
public ListalImageDownloadThread(URL url, int index) {
|
||||||
super();
|
super();
|
||||||
|
@@ -120,7 +120,7 @@ public class LusciousRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LusciousDownloadThread extends Thread {
|
public class LusciousDownloadThread implements Runnable {
|
||||||
private final URL url;
|
private final URL url;
|
||||||
private final int index;
|
private final int index;
|
||||||
|
|
||||||
|
@@ -152,9 +152,9 @@ public class MotherlessRipper extends AbstractHTMLRipper {
|
|||||||
/**
|
/**
|
||||||
* Helper class to find and download images found on "image" pages
|
* Helper class to find and download images found on "image" pages
|
||||||
*/
|
*/
|
||||||
private class MotherlessImageThread extends Thread {
|
private class MotherlessImageThread implements Runnable {
|
||||||
private URL url;
|
private final URL url;
|
||||||
private int index;
|
private final int index;
|
||||||
|
|
||||||
MotherlessImageThread(URL url, int index) {
|
MotherlessImageThread(URL url, int index) {
|
||||||
super();
|
super();
|
||||||
|
@@ -196,10 +196,10 @@ public class NfsfwRipper extends AbstractHTMLRipper {
|
|||||||
/**
|
/**
|
||||||
* Helper class to find and download images found on "image" pages
|
* Helper class to find and download images found on "image" pages
|
||||||
*/
|
*/
|
||||||
private class NfsfwImageThread extends Thread {
|
private class NfsfwImageThread implements Runnable {
|
||||||
private URL url;
|
private final URL url;
|
||||||
private String subdir;
|
private final String subdir;
|
||||||
private int index;
|
private final int index;
|
||||||
|
|
||||||
NfsfwImageThread(URL url, String subdir, int index) {
|
NfsfwImageThread(URL url, String subdir, int index) {
|
||||||
super();
|
super();
|
||||||
|
@@ -126,9 +126,9 @@ public class PornhubRipper extends AbstractHTMLRipper {
|
|||||||
*
|
*
|
||||||
* Handles case when site has IP-banned the user.
|
* Handles case when site has IP-banned the user.
|
||||||
*/
|
*/
|
||||||
private class PornhubImageThread extends Thread {
|
private class PornhubImageThread implements Runnable {
|
||||||
private URL url;
|
private final URL url;
|
||||||
private int index;
|
private final int index;
|
||||||
|
|
||||||
PornhubImageThread(URL url, int index, Path workingDir) {
|
PornhubImageThread(URL url, int index, Path workingDir) {
|
||||||
super();
|
super();
|
||||||
|
Reference in New Issue
Block a user