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;
|
||||||
@ -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,6 +42,22 @@ 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;
|
||||||
}
|
}
|
||||||
|
if (Utils.getConfigBoolean("urls_only.save", false)) {
|
||||||
|
// Output URL to file
|
||||||
|
String urlFile = this.workingDir + File.separator + "urls.txt";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
itemsPending.put(url, saveAs);
|
itemsPending.put(url, saveAs);
|
||||||
DownloadFileThread dft = new DownloadFileThread(url, saveAs, this);
|
DownloadFileThread dft = new DownloadFileThread(url, saveAs, this);
|
||||||
if (referrer != null) {
|
if (referrer != null) {
|
||||||
@ -51,6 +68,7 @@ public abstract class AlbumRipper extends AbstractRipper {
|
|||||||
}
|
}
|
||||||
threadPool.addThread(dft);
|
threadPool.addThread(dft);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addURLToDownload(URL url, File saveAs) {
|
public void addURLToDownload(URL url, File saveAs) {
|
||||||
|
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user