From e303945d3df4d762ab6f83a55617dff2e2380745 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Fri, 25 Jul 2014 00:48:52 -0700 Subject: [PATCH] Save directories named after album titles are now optional --- .../com/rarchives/ripme/ripper/AlbumRipper.java | 9 +++++++-- .../java/com/rarchives/ripme/ui/MainWindow.java | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/AlbumRipper.java b/src/main/java/com/rarchives/ripme/ripper/AlbumRipper.java index cebcbca0..09f117af 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AlbumRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AlbumRipper.java @@ -145,7 +145,7 @@ public abstract class AlbumRipper extends AbstractRipper { /** * Sets directory to save all ripped files to. * @param url - * URL to define how the workin directory should be saved. + * URL to define how the working directory should be saved. */ @Override public void setWorkingDir(URL url) throws IOException { @@ -153,7 +153,12 @@ public abstract class AlbumRipper extends AbstractRipper { if (!path.endsWith(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); path += title + File.separator; this.workingDir = new File(path); diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index bd6c7d69..a15343f6 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -111,6 +111,7 @@ public class MainWindow implements Runnable, RipStatusHandler { private static JCheckBox configShowPopup; private static JCheckBox configSaveLogs; private static JCheckBox configSaveURLsOnly; + private static JCheckBox configSaveAlbumTitles; private static TrayIcon trayIcon; private static MenuItem trayMenuMain; @@ -178,6 +179,7 @@ public class MainWindow implements Runnable, RipStatusHandler { Utils.setConfigBoolean("download.show_popup", configShowPopup.isSelected()); Utils.setConfigBoolean("log.save", configSaveLogs.isSelected()); Utils.setConfigBoolean("urls_only.save", configSaveURLsOnly.isSelected()); + Utils.setConfigBoolean("album_titles.save", configSaveAlbumTitles.isSelected()); saveHistory(); 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.setHorizontalAlignment(JCheckBox.RIGHT); 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(); try { String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory())); @@ -365,7 +370,8 @@ public class MainWindow implements Runnable, RipStatusHandler { gbc.gridx = 1; configurationPanel.add(configSaveLogs, 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(configSaveAlbumTitles, gbc); + gbc.gridy = 9; gbc.gridx = 0; configurationPanel.add(configSaveDirLabel, gbc); gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc); gbc.gridy = 0; pane.add(ripPanel, gbc); @@ -573,6 +579,13 @@ public class MainWindow implements Runnable, RipStatusHandler { Utils.configureLogger(); } }); + configSaveAlbumTitles.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + Utils.setConfigBoolean("album_titles.save", configSaveAlbumTitles.isSelected()); + Utils.configureLogger(); + } + }); } private void setupTrayIcon() {