From 315c703e3cea9b1109aefbfacf7baa3569c124b9 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Sat, 28 Jun 2014 09:49:11 -0700 Subject: [PATCH] 'Save URLs only' works for videos --- .../rarchives/ripme/ripper/VideoRipper.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/VideoRipper.java b/src/main/java/com/rarchives/ripme/ripper/VideoRipper.java index b80339c4..2e1ae173 100644 --- a/src/main/java/com/rarchives/ripme/ripper/VideoRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/VideoRipper.java @@ -1,6 +1,7 @@ package com.rarchives.ripme.ripper; import java.io.File; +import java.io.FileWriter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -40,7 +41,23 @@ public abstract class VideoRipper extends AbstractRipper { @Override public void addURLToDownload(URL url, File saveAs) { - threadPool.addThread(new DownloadVideoThread(url, saveAs, this)); + if (Utils.getConfigBoolean("urls_only.save", false)) { + // Output URL to file + String urlFile = this.workingDir + File.separator + "urls.txt"; + try { + FileWriter fw = new FileWriter(urlFile, true); + fw.write(url.toExternalForm()); + fw.write("\n"); + fw.close(); + RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, urlFile); + observer.update(this, msg); + } catch (IOException e) { + logger.error("Error while writing to " + urlFile, e); + } + } + else { + threadPool.addThread(new DownloadVideoThread(url, saveAs, this)); + } } @Override