diff --git a/pom.xml b/pom.xml index 3870b89e..41f731de 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.2.7 + 1.2.8 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java index 78d9bcd5..0d3cac1c 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java @@ -212,11 +212,15 @@ public class ImgurRipper extends AlbumRipper { int imagesLength = images.length(); for (int i = 0; i < imagesLength; i++) { JSONObject image = images.getJSONObject(i); + String ext = image.getString("ext"); + if (ext.equals(".gif") && Utils.getConfigBoolean("prefer.mp4", false)) { + ext = ".mp4"; + } URL imageURL = new URL( // CDN url is provided elsewhere in the document "http://i.imgur.com/" + image.get("hash") - + image.get("ext")); + + ext); ImgurImage imgurImage = new ImgurImage(imageURL, image.getString("title"), image.getString("description")); @@ -239,12 +243,16 @@ public class ImgurRipper extends AlbumRipper { int imagesLength = images.length(); for (int i = 0; i < imagesLength; i++) { JSONObject image = images.getJSONObject(i); + String ext = image.getString("ext"); + if (ext.equals(".gif") && Utils.getConfigBoolean("prefer.mp4", false)) { + ext = ".mp4"; + } URL imageURL = new URL( "http://i.imgur.com/" + image.getString("hash") - + image.getString("ext")); + + ext); ImgurImage imgurImage = new ImgurImage(imageURL); - imgurImage.extension = image.getString("ext"); + imgurImage.extension = ext; imgurAlbum.addImage(imgurImage); } return imgurAlbum; @@ -280,6 +288,9 @@ public class ImgurRipper extends AlbumRipper { logger.error("[!] Unable to find image in div: " + thumb.toString()); continue; } + if (image.endsWith(".gif") && Utils.getConfigBoolean("prefer.mp4", false)) { + image = image.replace(".gif", ".mp4"); + } ImgurImage imgurImage = new ImgurImage(new URL(image)); imgurAlbum.addImage(imgurImage); } diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 7b82137e..6faa14b7 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -137,6 +137,7 @@ public class MainWindow implements Runnable, RipStatusHandler { private static JCheckBox configSaveAlbumTitles; private static JCheckBox configClipboardAutorip; private static JCheckBox configSaveDescriptions; + private static JCheckBox configPreferMp4; private static TrayIcon trayIcon; private static MenuItem trayMenuMain; @@ -210,6 +211,7 @@ public class MainWindow implements Runnable, RipStatusHandler { Utils.setConfigBoolean("album_titles.save", configSaveAlbumTitles.isSelected()); Utils.setConfigBoolean("clipboard.autorip", configClipboardAutorip.isSelected()); Utils.setConfigBoolean("descriptions.save", configSaveDescriptions.isSelected()); + Utils.setConfigBoolean("prefer.mp4", configPreferMp4.isSelected()); saveHistory(); Utils.saveConfig(); } @@ -462,6 +464,9 @@ public class MainWindow implements Runnable, RipStatusHandler { configSaveDescriptions = new JCheckBox("Save descriptions", Utils.getConfigBoolean("descriptions.save", true)); configSaveDescriptions.setHorizontalAlignment(JCheckBox.RIGHT); configSaveDescriptions.setHorizontalTextPosition(JCheckBox.LEFT); + configPreferMp4 = new JCheckBox("Prefer MP4 over GIF", Utils.getConfigBoolean("prefer.mp4", false)); + configPreferMp4.setHorizontalAlignment(JCheckBox.RIGHT); + configPreferMp4.setHorizontalTextPosition(JCheckBox.LEFT); configSaveDirLabel = new JLabel(); try { String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory())); @@ -489,6 +494,7 @@ public class MainWindow implements Runnable, RipStatusHandler { gbc.gridy = 8; gbc.gridx = 0; configurationPanel.add(configClipboardAutorip, gbc); gbc.gridx = 1; configurationPanel.add(configSaveAlbumTitles, gbc); 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(configSaveDirLabel, gbc); gbc.gridx = 1; configurationPanel.add(configSaveDirButton, gbc); @@ -750,6 +756,13 @@ public class MainWindow implements Runnable, RipStatusHandler { Utils.configureLogger(); } }); + configPreferMp4.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + Utils.setConfigBoolean("prefer.mp4", configPreferMp4.isSelected()); + Utils.configureLogger(); + } + }); queueListModel.addListDataListener(new ListDataListener() { @Override public void intervalAdded(ListDataEvent arg0) { diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 1bc5ce28..5653b6c4 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.2.7"; + private static final String DEFAULT_VERSION = "1.2.8"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";