Save directories named after album titles are now optional

This commit is contained in:
4pr0n 2014-07-25 00:48:52 -07:00
parent bc234efba6
commit e303945d3d
2 changed files with 21 additions and 3 deletions

View File

@ -145,7 +145,7 @@ public abstract class AlbumRipper extends AbstractRipper {
/** /**
* Sets directory to save all ripped files to. * Sets directory to save all ripped files to.
* @param url * @param url
* URL to define how the workin directory should be saved. * URL to define how the working directory should be saved.
*/ */
@Override @Override
public void setWorkingDir(URL url) throws IOException { public void setWorkingDir(URL url) throws IOException {
@ -153,7 +153,12 @@ public abstract class AlbumRipper extends AbstractRipper {
if (!path.endsWith(File.separator)) { if (!path.endsWith(File.separator)) {
path += File.separator; path += File.separator;
} }
String title = getAlbumTitle(this.url); String title;
if (Utils.getConfigBoolean("album_titles.save", true)) {
title = getAlbumTitle(this.url);
} else {
title = super.getAlbumTitle(this.url);
}
title = Utils.filesystemSafe(title); title = Utils.filesystemSafe(title);
path += title + File.separator; path += title + File.separator;
this.workingDir = new File(path); this.workingDir = new File(path);

View File

@ -111,6 +111,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
private static JCheckBox configShowPopup; private static JCheckBox configShowPopup;
private static JCheckBox configSaveLogs; private static JCheckBox configSaveLogs;
private static JCheckBox configSaveURLsOnly; private static JCheckBox configSaveURLsOnly;
private static JCheckBox configSaveAlbumTitles;
private static TrayIcon trayIcon; private static TrayIcon trayIcon;
private static MenuItem trayMenuMain; private static MenuItem trayMenuMain;
@ -178,6 +179,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
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()); Utils.setConfigBoolean("urls_only.save", configSaveURLsOnly.isSelected());
Utils.setConfigBoolean("album_titles.save", configSaveAlbumTitles.isSelected());
saveHistory(); saveHistory();
Utils.saveConfig(); Utils.saveConfig();
} }
@ -342,6 +344,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
configSaveURLsOnly = new JCheckBox("Save URLs only", Utils.getConfigBoolean("urls_only.save", false)); configSaveURLsOnly = new JCheckBox("Save URLs only", Utils.getConfigBoolean("urls_only.save", false));
configSaveURLsOnly.setHorizontalAlignment(JCheckBox.RIGHT); configSaveURLsOnly.setHorizontalAlignment(JCheckBox.RIGHT);
configSaveURLsOnly.setHorizontalTextPosition(JCheckBox.LEFT); configSaveURLsOnly.setHorizontalTextPosition(JCheckBox.LEFT);
configSaveAlbumTitles = new JCheckBox("Save album titles", Utils.getConfigBoolean("album_titles.save", true));
configSaveAlbumTitles.setHorizontalAlignment(JCheckBox.RIGHT);
configSaveAlbumTitles.setHorizontalTextPosition(JCheckBox.LEFT);
configSaveDirLabel = new JLabel(); configSaveDirLabel = new JLabel();
try { try {
String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory())); String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
@ -365,7 +370,8 @@ public class MainWindow implements Runnable, RipStatusHandler {
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.gridx = 1; configurationPanel.add(configSaveURLsOnly, gbc);
gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc); gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configSaveAlbumTitles, 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);
@ -573,6 +579,13 @@ public class MainWindow implements Runnable, RipStatusHandler {
Utils.configureLogger(); Utils.configureLogger();
} }
}); });
configSaveAlbumTitles.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Utils.setConfigBoolean("album_titles.save", configSaveAlbumTitles.isSelected());
Utils.configureLogger();
}
});
} }
private void setupTrayIcon() { private void setupTrayIcon() {