diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-10-15 17:19:05 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-10-15 17:19:05 -0700 |
| commit | 4138c41ff23e6d0e61a13646c3e4115522323588 (patch) | |
| tree | f99021fb1ab874c6f746f2cfe5ef4fbad2f8669b /src/main/java/Downloader.java | |
| parent | 5f0c90afdd30f97a2f941053e62527c362babd60 (diff) | |
add default 3 retry attempts to any download
Diffstat (limited to 'src/main/java/Downloader.java')
| -rw-r--r-- | src/main/java/Downloader.java | 8 |
1 files changed, 1 insertions, 7 deletions
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))){ |
