From 4138c41ff23e6d0e61a13646c3e4115522323588 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 15 Oct 2025 17:19:05 -0700 Subject: add default 3 retry attempts to any download --- src/main/java/Downloader.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/main/java/Downloader.java') diff --git a/src/main/java/Downloader.java b/src/main/java/Downloader.java index 6442605..05363f1 100644 --- a/src/main/java/Downloader.java +++ b/src/main/java/Downloader.java @@ -108,7 +108,6 @@ public class Downloader { } File downloadedWebm = FileUtility.findFileWithType(System.getProperty("user.dir"), "webm"); if(downloadedWebm == null){ - UI.Modal.showError("Error finding downloaded webm file. Ensure that yt-dlp is able to download"); return false; } @@ -138,7 +137,6 @@ public class Downloader { String imageUrl = "https://img.youtube.com/vi/" + urlID+"/"; File downloadedMp3 = FileUtility.findFileWithType(System.getProperty("user.dir"), "mp3"); if(downloadedMp3 == null){ - UI.Modal.showError("Error finding downloaded mp3 file. Ensure that yt-dlp is able to download"); return false; } String savedNonAlphaNumName; @@ -146,7 +144,6 @@ public class Downloader { savedNonAlphaNumName = downloadedMp3.getName(); } catch(NullPointerException ex){ - UI.Modal.showError("Error finding downloaded mp3 file. Ensure that yt-dlp is able to download"); return false; } String tempRemoveAlphaNumeric = savedNonAlphaNumName.replaceAll("[^a-zA-Z0-9]", "") + ".mp3"; @@ -157,7 +154,6 @@ public class Downloader { FileUtility.deleteFile(FileUtility.findJsonFile(System.getProperty("user.dir"))); downloadedMp3 = FileUtility.findFileWithType(System.getProperty("user.dir"), "mp3"); if(downloadedMp3 == null){ - UI.Modal.showError("Error finding downloaded mp3 file. Ensure that yt-dlp is able to download"); return false; } if(!downloadedMp3.renameTo(new File(outputDirectory+"/"+savedNonAlphaNumName+"["+startTime+"-"+endTime+"].mp3"))){ @@ -170,7 +166,7 @@ public class Downloader { public boolean download(String url, String browser){ String ytDlpExecutable = "yt-dlp" + (System.getProperty("os.name").startsWith("Windows") ? ".exe" : ""); try { - String[] command = {ytDlpExecutable, "--min-sleep-interval","2", "--max-sleep-interval", "7","--cookies-from-browser",browser,"-f", "bestaudio[ext=webm]", "-x", + String[] command = {ytDlpExecutable, "-4","--min-sleep-interval","2", "--max-sleep-interval", "7","--cookies-from-browser",browser,"-f", "bestaudio[ext=webm]", "-x", "--audio-format", "mp3", "--write-info-json", url, "-o", "%(title)s[%(id)s].%(ext)s"}; ProcessBuilder processBuilder = new ProcessBuilder(command); processBuilder.directory(new File(System.getProperty("user.dir"))); @@ -188,7 +184,6 @@ public class Downloader { String imageUrl = "https://img.youtube.com/vi/" + urlID + "/"; File downloadedMp3 = FileUtility.findFileWithType(System.getProperty("user.dir"), "mp3"); if(downloadedMp3 == null){ - UI.Modal.showError("Error finding downloaded mp3 file. Ensure that yt-dlp is able to download"); return false; } String savedNonAlphaNumName = downloadedMp3.getName(); @@ -202,7 +197,6 @@ public class Downloader { tagMp3InDir(uploader, title, imageUrl, System.getProperty("user.dir")); downloadedMp3 = FileUtility.findFileWithType(System.getProperty("user.dir"), "mp3"); if(downloadedMp3 == null){ - UI.Modal.showError("Error finding downloaded mp3 file. Ensure that yt-dlp is able to download"); return false; } if(!downloadedMp3.renameTo(new File(outputDirectory+"/"+savedNonAlphaNumName))){ -- cgit v1.2.3