1.0.59 - Detect when an album can be ripped instantly #60
This commit is contained in:
parent
fe24620e47
commit
add3c043b2
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>com.rarchives.ripme</groupId>
|
||||
<artifactId>ripme</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.58</version>
|
||||
<version>1.0.59</version>
|
||||
<name>ripme</name>
|
||||
<url>http://rip.rarchives.com</url>
|
||||
<properties>
|
||||
|
@ -303,13 +303,17 @@ public abstract class AbstractRipper
|
||||
waitForThreads();
|
||||
sendUpdate(STATUS.RIP_ERRORED, e.getMessage());
|
||||
} finally {
|
||||
if (this.workingDir.list().length == 0) {
|
||||
// No files, delete the dir
|
||||
logger.info("Deleting empty directory " + this.workingDir);
|
||||
boolean deleteResult = this.workingDir.delete();
|
||||
if (!deleteResult) {
|
||||
logger.error("Unable to delete empty directory " + this.workingDir);
|
||||
}
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (this.workingDir.list().length == 0) {
|
||||
// No files, delete the dir
|
||||
logger.info("Deleting empty directory " + this.workingDir);
|
||||
boolean deleteResult = this.workingDir.delete();
|
||||
if (!deleteResult) {
|
||||
logger.error("Unable to delete empty directory " + this.workingDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ import javax.swing.ListSelectionModel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.SimpleAttributeSet;
|
||||
import javax.swing.text.StyleConstants;
|
||||
@ -357,6 +359,41 @@ public class MainWindow implements Runnable, RipStatusHandler {
|
||||
private void setupHandlers() {
|
||||
ripButton.addActionListener(new RipButtonHandler());
|
||||
ripTextfield.addActionListener(new RipButtonHandler());
|
||||
ripTextfield.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
update();
|
||||
}
|
||||
private void update() {
|
||||
if (!ripTextfield.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String urlText = ripTextfield.getText();
|
||||
if (!urlText.startsWith("http:")) {
|
||||
urlText = "http://" + urlText;
|
||||
}
|
||||
URL url = new URL(urlText);
|
||||
AbstractRipper ripper = AbstractRipper.getRipper(url);
|
||||
statusWithColor(ripper.getHost() + " album detected", Color.GREEN);
|
||||
File dir = ripper.getWorkingDir();
|
||||
if (dir.list().length == 1) {
|
||||
new File(dir.getAbsolutePath() + File.separator + "log.txt").delete();
|
||||
}
|
||||
ripper.cleanup();
|
||||
} catch (Exception e) {
|
||||
statusWithColor("Can't rip this URL", Color.RED);
|
||||
}
|
||||
}
|
||||
});
|
||||
stopButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
|
@ -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.0.58";
|
||||
private static final String DEFAULT_VERSION = "1.0.59";
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user