1.0.52 - Imgbox ripper, notifications are optional
Both for #8 Popup notifications are now a config-option, defaults to false
This commit is contained in:
parent
f79f0cdc3c
commit
13d13b28b7
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<groupId>com.rarchives.ripme</groupId>
|
<groupId>com.rarchives.ripme</groupId>
|
||||||
<artifactId>ripme</artifactId>
|
<artifactId>ripme</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.51</version>
|
<version>1.0.52</version>
|
||||||
<name>ripme</name>
|
<name>ripme</name>
|
||||||
<url>http://rip.rarchives.com</url>
|
<url>http://rip.rarchives.com</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.rarchives.ripme.ripper.rippers;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import com.rarchives.ripme.ripper.AlbumRipper;
|
||||||
|
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
||||||
|
import com.rarchives.ripme.utils.Utils;
|
||||||
|
|
||||||
|
public class ImgboxRipper extends AlbumRipper {
|
||||||
|
|
||||||
|
private static final String DOMAIN = "imgbox.com",
|
||||||
|
HOST = "imgbox";
|
||||||
|
private static final Logger logger = Logger.getLogger(ImgboxRipper.class);
|
||||||
|
|
||||||
|
public ImgboxRipper(URL url) throws IOException {
|
||||||
|
super(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRip(URL url) {
|
||||||
|
return url.getHost().endsWith(DOMAIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public URL sanitizeURL(URL url) throws MalformedURLException {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rip() throws IOException {
|
||||||
|
logger.info(" Retrieving " + this.url);
|
||||||
|
sendUpdate(STATUS.LOADING_RESOURCE, url.toExternalForm());
|
||||||
|
Document doc = Jsoup.connect(this.url.toExternalForm())
|
||||||
|
.userAgent(USER_AGENT)
|
||||||
|
.get();
|
||||||
|
Elements images = doc.select("div.boxed-content > a > img");
|
||||||
|
if (images.size() == 0) {
|
||||||
|
logger.error("No images found at " + this.url);
|
||||||
|
throw new IOException("No images found at " + this.url);
|
||||||
|
}
|
||||||
|
int index = 0;
|
||||||
|
for (Element image : images) {
|
||||||
|
index++;
|
||||||
|
String imageUrl = image.attr("src").replace("s.imgbox.com", "i.imgbox.com");
|
||||||
|
String prefix = "";
|
||||||
|
if (Utils.getConfigBoolean("download.save_order", true)) {
|
||||||
|
prefix = String.format("%03d_", index);
|
||||||
|
}
|
||||||
|
addURLToDownload(new URL(imageUrl), prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForThreads();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHost() {
|
||||||
|
return HOST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
|
Pattern p = Pattern.compile("^https?://[wm.]*imgbox\\.com/g/([a-zA-Z0-9]+).*$");
|
||||||
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
|
if (m.matches()) {
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
throw new MalformedURLException("Expected imgbox.com URL format: " +
|
||||||
|
"imgbox.com/g/albumid - got " + url + "instead");
|
||||||
|
}
|
||||||
|
}
|
@ -106,6 +106,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
private static JCheckBox configAutoupdateCheckbox;
|
private static JCheckBox configAutoupdateCheckbox;
|
||||||
private static JCheckBox configPlaySound;
|
private static JCheckBox configPlaySound;
|
||||||
private static JCheckBox configSaveOrderCheckbox;
|
private static JCheckBox configSaveOrderCheckbox;
|
||||||
|
private static JCheckBox configShowPopup;
|
||||||
|
|
||||||
private static TrayIcon trayIcon;
|
private static TrayIcon trayIcon;
|
||||||
private static MenuItem trayMenuMain;
|
private static MenuItem trayMenuMain;
|
||||||
@ -170,6 +171,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
Utils.setConfigBoolean("auto.update", configAutoupdateCheckbox.isSelected());
|
Utils.setConfigBoolean("auto.update", configAutoupdateCheckbox.isSelected());
|
||||||
Utils.setConfigBoolean("play.sound", configPlaySound.isSelected());
|
Utils.setConfigBoolean("play.sound", configPlaySound.isSelected());
|
||||||
Utils.setConfigBoolean("download.save_order", configSaveOrderCheckbox.isSelected());
|
Utils.setConfigBoolean("download.save_order", configSaveOrderCheckbox.isSelected());
|
||||||
|
Utils.setConfigBoolean("download.show_popup", configShowPopup.isSelected());
|
||||||
saveHistory();
|
saveHistory();
|
||||||
Utils.saveConfig();
|
Utils.saveConfig();
|
||||||
}
|
}
|
||||||
@ -316,6 +318,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
configSaveOrderCheckbox = new JCheckBox("Save images in order", Utils.getConfigBoolean("download.save_order", true));
|
configSaveOrderCheckbox = new JCheckBox("Save images in order", Utils.getConfigBoolean("download.save_order", true));
|
||||||
configSaveOrderCheckbox.setHorizontalAlignment(JCheckBox.RIGHT);
|
configSaveOrderCheckbox.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||||
configSaveOrderCheckbox.setHorizontalTextPosition(JCheckBox.LEFT);
|
configSaveOrderCheckbox.setHorizontalTextPosition(JCheckBox.LEFT);
|
||||||
|
configShowPopup = new JCheckBox("Notification when rip starts", Utils.getConfigBoolean("download.show_popup", false));
|
||||||
|
configShowPopup.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||||
|
configShowPopup.setHorizontalTextPosition(JCheckBox.LEFT);
|
||||||
configSaveDirLabel = new JLabel();
|
configSaveDirLabel = new JLabel();
|
||||||
try {
|
try {
|
||||||
String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
|
String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
|
||||||
@ -336,7 +341,8 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
gbc.gridy = 5; gbc.gridx = 0; configurationPanel.add(configOverwriteCheckbox, gbc);
|
gbc.gridy = 5; gbc.gridx = 0; configurationPanel.add(configOverwriteCheckbox, gbc);
|
||||||
gbc.gridy = 6; gbc.gridx = 0; configurationPanel.add(configPlaySound, gbc);
|
gbc.gridy = 6; gbc.gridx = 0; configurationPanel.add(configPlaySound, gbc);
|
||||||
gbc.gridy = 7; gbc.gridx = 0; configurationPanel.add(configSaveOrderCheckbox, gbc);
|
gbc.gridy = 7; gbc.gridx = 0; configurationPanel.add(configSaveOrderCheckbox, gbc);
|
||||||
gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc);
|
gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configShowPopup, gbc);
|
||||||
|
gbc.gridy = 9; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc);
|
||||||
gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc);
|
gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc);
|
||||||
|
|
||||||
gbc.gridy = 0; pane.add(ripPanel, gbc);
|
gbc.gridy = 0; pane.add(ripPanel, gbc);
|
||||||
@ -699,7 +705,8 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
ripper.setObserver((RipStatusHandler) this);
|
ripper.setObserver((RipStatusHandler) this);
|
||||||
Thread t = new Thread(ripper);
|
Thread t = new Thread(ripper);
|
||||||
t.start();
|
t.start();
|
||||||
if (!mainFrame.isVisible() || !mainFrame.isActive()) {
|
if (configShowPopup.isSelected() &&
|
||||||
|
(!mainFrame.isVisible() || !mainFrame.isActive())) {
|
||||||
mainFrame.toFront();
|
mainFrame.toFront();
|
||||||
mainFrame.setAlwaysOnTop(true);
|
mainFrame.setAlwaysOnTop(true);
|
||||||
trayIcon.displayMessage(mainFrame.getTitle(), "Started ripping " + ripper.getURL().toExternalForm(), MessageType.INFO);
|
trayIcon.displayMessage(mainFrame.getTitle(), "Started ripping " + ripper.getURL().toExternalForm(), MessageType.INFO);
|
||||||
|
@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
|
|||||||
public class UpdateUtils {
|
public class UpdateUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
||||||
private static final String DEFAULT_VERSION = "1.0.51";
|
private static final String DEFAULT_VERSION = "1.0.52";
|
||||||
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
||||||
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
||||||
private static final String mainFileName = "ripme.jar";
|
private static final String mainFileName = "ripme.jar";
|
||||||
|
Loading…
Reference in New Issue
Block a user