Now uses checkbox for remember.url_history setting
This commit is contained in:
parent
9898c149e1
commit
d5c1efd939
@ -159,10 +159,12 @@ public abstract class AbstractRipper
|
||||
protected abstract boolean addURLToDownload(URL url, File saveAs, String referrer, Map<String, String> cookies);
|
||||
|
||||
protected boolean addURLToDownload(URL url, String prefix, String subdirectory, String referrer, Map<String, String> cookies) {
|
||||
if (Utils.getConfigBoolean("remember.url_history", true)) {
|
||||
if (hasDownloadedURL(url.toExternalForm())) {
|
||||
sendUpdate(STATUS.DOWNLOAD_WARN, "Already downloaded " + url.toExternalForm());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
stopCheck();
|
||||
} catch (IOException e) {
|
||||
@ -196,11 +198,13 @@ public abstract class AbstractRipper
|
||||
logger.info("[+] Creating directory: " + Utils.removeCWD(saveFileAs.getParent()));
|
||||
saveFileAs.getParentFile().mkdirs();
|
||||
}
|
||||
if (Utils.getConfigBoolean("remember.url_history", true)) {
|
||||
try {
|
||||
writeDownloadedURL(url.toExternalForm() + "\n");
|
||||
} catch (IOException e) {
|
||||
logger.debug("Unable to write URL history file");
|
||||
}
|
||||
}
|
||||
return addURLToDownload(url, saveFileAs, referrer, cookies);
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
||||
private static JTextField configRetriesText;
|
||||
private static JCheckBox configAutoupdateCheckbox;
|
||||
private static JComboBox configLogLevelCombobox;
|
||||
private static JCheckBox configURLHistoryCheckbox;
|
||||
private static JCheckBox configPlaySound;
|
||||
private static JCheckBox configSaveOrderCheckbox;
|
||||
private static JCheckBox configShowPopup;
|
||||
@ -191,6 +192,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
||||
Utils.setConfigBoolean("clipboard.autorip", configClipboardAutorip.isSelected());
|
||||
Utils.setConfigBoolean("descriptions.save", configSaveDescriptions.isSelected());
|
||||
Utils.setConfigBoolean("prefer.mp4", configPreferMp4.isSelected());
|
||||
Utils.setConfigBoolean("remember.url_history", configURLHistoryCheckbox.isSelected());
|
||||
saveWindowPosition(mainFrame);
|
||||
saveHistory();
|
||||
Utils.saveConfig();
|
||||
@ -489,6 +491,9 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
||||
configWindowPosition = new JCheckBox("Restore window position", Utils.getConfigBoolean("window.position", true));
|
||||
configWindowPosition.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||
configWindowPosition.setHorizontalTextPosition(JCheckBox.LEFT);
|
||||
configURLHistoryCheckbox = new JCheckBox("Remember URL history", Utils.getConfigBoolean("remember.url_history", true));
|
||||
configURLHistoryCheckbox.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||
configURLHistoryCheckbox.setHorizontalTextPosition(JCheckBox.LEFT);
|
||||
configSaveDirLabel = new JLabel();
|
||||
try {
|
||||
String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
|
||||
@ -520,9 +525,11 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
||||
gbc.gridy = 9; gbc.gridx = 0; configurationPanel.add(configSaveDescriptions, gbc);
|
||||
gbc.gridx = 1; configurationPanel.add(configPreferMp4, gbc);
|
||||
gbc.gridy = 10; gbc.gridx = 0; configurationPanel.add(configWindowPosition, gbc);
|
||||
gbc.gridx = 1; configurationPanel.add(configURLHistoryCheckbox, gbc);
|
||||
gbc.gridy = 11; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc);
|
||||
gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc);
|
||||
|
||||
|
||||
emptyPanel = new JPanel();
|
||||
emptyPanel.setPreferredSize(new Dimension(0, 0));
|
||||
emptyPanel.setSize(0, 0);
|
||||
@ -744,6 +751,10 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
||||
Utils.setConfigBoolean("urls_only.save", configSaveURLsOnly.isSelected());
|
||||
Utils.configureLogger();
|
||||
});
|
||||
configURLHistoryCheckbox.addActionListener(arg0 -> {
|
||||
Utils.setConfigBoolean("remember.url_history", configURLHistoryCheckbox.isSelected());
|
||||
Utils.configureLogger();
|
||||
});
|
||||
configSaveAlbumTitles.addActionListener(arg0 -> {
|
||||
Utils.setConfigBoolean("album_titles.save", configSaveAlbumTitles.isSelected());
|
||||
Utils.configureLogger();
|
||||
|
Loading…
Reference in New Issue
Block a user