Option to only save URLs to images, not download
This commit is contained in:
parent
baab27d6af
commit
97506c8741
@ -1,5 +1,6 @@
|
|||||||
package com.rarchives.ripme.ripper;
|
package com.rarchives.ripme.ripper;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
@ -208,7 +209,7 @@ public abstract class AbstractRipper
|
|||||||
if (!completed) {
|
if (!completed) {
|
||||||
completed = true;
|
completed = true;
|
||||||
logger.info(" Rip completed!");
|
logger.info(" Rip completed!");
|
||||||
|
|
||||||
RipStatusMessage msg = new RipStatusMessage(STATUS.RIP_COMPLETE, workingDir);
|
RipStatusMessage msg = new RipStatusMessage(STATUS.RIP_COMPLETE, workingDir);
|
||||||
observer.update(this, msg);
|
observer.update(this, msg);
|
||||||
Logger rootLogger = Logger.getRootLogger();
|
Logger rootLogger = Logger.getRootLogger();
|
||||||
@ -217,6 +218,14 @@ public abstract class AbstractRipper
|
|||||||
fa.setFile("ripme.log");
|
fa.setFile("ripme.log");
|
||||||
fa.activateOptions();
|
fa.activateOptions();
|
||||||
}
|
}
|
||||||
|
if (Utils.getConfigBoolean("urls_only.save", false)) {
|
||||||
|
String urlFile = this.workingDir + File.separator + "urls.txt";
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().open(new File(urlFile));
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.warn("Error while opening " + urlFile, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.rarchives.ripme.ripper;
|
package com.rarchives.ripme.ripper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -41,15 +42,32 @@ public abstract class AlbumRipper extends AbstractRipper {
|
|||||||
logger.info("[!] Skipping " + url + " -- already attempted: " + Utils.removeCWD(saveAs));
|
logger.info("[!] Skipping " + url + " -- already attempted: " + Utils.removeCWD(saveAs));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
itemsPending.put(url, saveAs);
|
if (Utils.getConfigBoolean("urls_only.save", false)) {
|
||||||
DownloadFileThread dft = new DownloadFileThread(url, saveAs, this);
|
// Output URL to file
|
||||||
if (referrer != null) {
|
String urlFile = this.workingDir + File.separator + "urls.txt";
|
||||||
dft.setReferrer(referrer);
|
try {
|
||||||
|
FileWriter fw = new FileWriter(urlFile, true);
|
||||||
|
fw.write(url.toExternalForm());
|
||||||
|
fw.write("\n");
|
||||||
|
fw.close();
|
||||||
|
RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, urlFile);
|
||||||
|
itemsCompleted.put(url, new File(urlFile));
|
||||||
|
observer.update(this, msg);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Error while writing to " + urlFile, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cookies != null) {
|
else {
|
||||||
dft.setCookies(cookies);
|
itemsPending.put(url, saveAs);
|
||||||
|
DownloadFileThread dft = new DownloadFileThread(url, saveAs, this);
|
||||||
|
if (referrer != null) {
|
||||||
|
dft.setReferrer(referrer);
|
||||||
|
}
|
||||||
|
if (cookies != null) {
|
||||||
|
dft.setCookies(cookies);
|
||||||
|
}
|
||||||
|
threadPool.addThread(dft);
|
||||||
}
|
}
|
||||||
threadPool.addThread(dft);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,6 +110,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
private static JCheckBox configSaveOrderCheckbox;
|
private static JCheckBox configSaveOrderCheckbox;
|
||||||
private static JCheckBox configShowPopup;
|
private static JCheckBox configShowPopup;
|
||||||
private static JCheckBox configSaveLogs;
|
private static JCheckBox configSaveLogs;
|
||||||
|
private static JCheckBox configSaveURLsOnly;
|
||||||
|
|
||||||
private static TrayIcon trayIcon;
|
private static TrayIcon trayIcon;
|
||||||
private static MenuItem trayMenuMain;
|
private static MenuItem trayMenuMain;
|
||||||
@ -176,6 +177,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
Utils.setConfigBoolean("download.save_order", configSaveOrderCheckbox.isSelected());
|
Utils.setConfigBoolean("download.save_order", configSaveOrderCheckbox.isSelected());
|
||||||
Utils.setConfigBoolean("download.show_popup", configShowPopup.isSelected());
|
Utils.setConfigBoolean("download.show_popup", configShowPopup.isSelected());
|
||||||
Utils.setConfigBoolean("log.save", configSaveLogs.isSelected());
|
Utils.setConfigBoolean("log.save", configSaveLogs.isSelected());
|
||||||
|
Utils.setConfigBoolean("urls_only.save", configSaveURLsOnly.isSelected());
|
||||||
saveHistory();
|
saveHistory();
|
||||||
Utils.saveConfig();
|
Utils.saveConfig();
|
||||||
}
|
}
|
||||||
@ -337,6 +339,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
configSaveLogs = new JCheckBox("Save logs", Utils.getConfigBoolean("log.save", false));
|
configSaveLogs = new JCheckBox("Save logs", Utils.getConfigBoolean("log.save", false));
|
||||||
configSaveLogs.setHorizontalAlignment(JCheckBox.RIGHT);
|
configSaveLogs.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||||
configSaveLogs.setHorizontalTextPosition(JCheckBox.LEFT);
|
configSaveLogs.setHorizontalTextPosition(JCheckBox.LEFT);
|
||||||
|
configSaveURLsOnly = new JCheckBox("Save URLs only", Utils.getConfigBoolean("urls_only.save", false));
|
||||||
|
configSaveURLsOnly.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||||
|
configSaveURLsOnly.setHorizontalTextPosition(JCheckBox.LEFT);
|
||||||
configSaveDirLabel = new JLabel();
|
configSaveDirLabel = new JLabel();
|
||||||
try {
|
try {
|
||||||
String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
|
String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
|
||||||
@ -359,6 +364,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
gbc.gridy = 6; gbc.gridx = 0; configurationPanel.add(configPlaySound, gbc);
|
gbc.gridy = 6; gbc.gridx = 0; configurationPanel.add(configPlaySound, gbc);
|
||||||
gbc.gridx = 1; configurationPanel.add(configSaveLogs, gbc);
|
gbc.gridx = 1; configurationPanel.add(configSaveLogs, gbc);
|
||||||
gbc.gridy = 7; gbc.gridx = 0; configurationPanel.add(configShowPopup, gbc);
|
gbc.gridy = 7; gbc.gridx = 0; configurationPanel.add(configShowPopup, gbc);
|
||||||
|
gbc.gridx = 1; configurationPanel.add(configSaveURLsOnly, gbc);
|
||||||
gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc);
|
gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc);
|
||||||
gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc);
|
gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc);
|
||||||
|
|
||||||
@ -560,6 +566,13 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
Utils.configureLogger();
|
Utils.configureLogger();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
configSaveURLsOnly.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
Utils.setConfigBoolean("urls_only.save", configSaveURLsOnly.isSelected());
|
||||||
|
Utils.configureLogger();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupTrayIcon() {
|
private void setupTrayIcon() {
|
||||||
@ -704,7 +717,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
|
|
||||||
logText.setCaretPosition(sd.getLength());
|
logText.setCaretPosition(sd.getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadHistory() {
|
private void loadHistory() {
|
||||||
for (String url : Utils.getConfigList("download.history")) {
|
for (String url : Utils.getConfigList("download.history")) {
|
||||||
historyListModel.addElement(url.trim());
|
historyListModel.addElement(url.trim());
|
||||||
|
Loading…
Reference in New Issue
Block a user