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