diff --git a/.github/ISSUE_TEMPLATE/Bug.yaml b/.github/ISSUE_TEMPLATE/Bug.yaml index ce3405de6..3a7f71baa 100644 --- a/.github/ISSUE_TEMPLATE/Bug.yaml +++ b/.github/ISSUE_TEMPLATE/Bug.yaml @@ -45,8 +45,9 @@ body: id: app-ver attributes: label: Application Version - description: Please select the application version (Check it here - https://github.com/SaptarshiSarkar12/Drifty/releases/latest/) + description: Please select the application version (Check it here - https://github.com/SaptarshiSarkar12/Drifty/releases/) options: + - v1.2.0 - v1.1.0 - v1.0.0 validations: @@ -64,4 +65,4 @@ body: label: Additional information description: Add any other context about the problem here. validations: - required: false \ No newline at end of file + required: false diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index 3e611cedd..52780d3a3 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -22,8 +22,9 @@ body: id: app-ver attributes: label: Application Version - description: Please select the application version (Check it here - https://github.com/SaptarshiSarkar12/Drifty/releases/latest/) + description: Please select the application version (Check it here - https://github.com/SaptarshiSarkar12/Drifty/releases/) options: + - v1.2.0 - v1.1.0 - v1.0.0 validations: @@ -41,4 +42,4 @@ body: label: Additional information description: Add any other context about the feature here. validations: - required: false \ No newline at end of file + required: false diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 2813b73ad..5deceefa0 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -14,8 +14,9 @@ body: id: app-ver attributes: label: Application Version - description: Please select the application version (Check it here - https://github.com/SaptarshiSarkar12/Drifty/releases/latest/) + description: Please select the application version (Check it here - https://github.com/SaptarshiSarkar12/Drifty/releases/) options: + - v1.2.0 - v1.1.0 - v1.0.0 validations: diff --git a/.idea/artifacts/Drifty_CLI_jar.xml b/.idea/artifacts/Drifty_CLI_jar.xml index 9e27ac14a..83c52eb01 100644 --- a/.idea/artifacts/Drifty_CLI_jar.xml +++ b/.idea/artifacts/Drifty_CLI_jar.xml @@ -3,6 +3,7 @@ $PROJECT_DIR$/out/artifacts/Drifty_CLI_jar + \ No newline at end of file diff --git a/Drifty.xml b/Drifty.xml index 46b22d0c7..fb9ef54f5 100644 --- a/Drifty.xml +++ b/Drifty.xml @@ -9,9 +9,9 @@ . normal http://java.com/download - https://github.com/SaptarshiSarkar12/Drifty/issues/new/choose + https://github.com/SaptarshiSarkar12/Drifty/discussions/ false - true + false D:\Drifty\Drifty.ico @@ -24,12 +24,12 @@ 64/32 - 1.1.0.0 - 1.0.0.0 + 1.2.0.0 + 1.1.0.0 Drifty is an open-source interactive File Downloader system built with java. Copyright © 2022 - 32 Saptarshi Sarkar - 1.1.0.0 - 1.0.0.0 + 1.2.0.0 + 1.1.0.0 Drifty Drifty CLI diff --git a/Drifty_CLI.exe b/Drifty_CLI.exe index f1d95a96e..f46d08dd9 100644 Binary files a/Drifty_CLI.exe and b/Drifty_CLI.exe differ diff --git a/out/artifacts/Drifty_CLI_jar/Drifty.jar b/out/artifacts/Drifty_CLI_jar/Drifty.jar index a456a1a41..ec9f5fde4 100644 Binary files a/out/artifacts/Drifty_CLI_jar/Drifty.jar and b/out/artifacts/Drifty_CLI_jar/Drifty.jar differ diff --git a/out/production/Drifty/Drifty_CLI.class b/out/production/Drifty/Drifty_CLI.class new file mode 100644 index 000000000..f060cdf4d Binary files /dev/null and b/out/production/Drifty/Drifty_CLI.class differ diff --git a/out/production/Drifty/FileDownloader.class b/out/production/Drifty/FileDownloader.class index 87be2e3ca..806219f2f 100644 Binary files a/out/production/Drifty/FileDownloader.class and b/out/production/Drifty/FileDownloader.class differ diff --git a/src/Drifty_CLI.java b/src/Drifty_CLI.java index c6619daf2..9c86b264c 100644 --- a/src/Drifty_CLI.java +++ b/src/Drifty_CLI.java @@ -14,6 +14,7 @@ public class Drifty_CLI { public static final String ANSI_PURPLE = "\u001B[35m"; private static boolean flag = false; private static String fName = null; + protected static boolean isYoutubeURL; /** * This function is the main method of the whole application. @@ -29,7 +30,7 @@ public static void main(String[] args) { String URL = args[0]; String name = null; String location = null; - for (int i = 0; i file.json String file = link.substring(link.lastIndexOf("/")+1); @@ -213,6 +215,7 @@ private static boolean containsFile(String link){ // file.png?width=200 -> file.png fName = file.split("([?])")[0]; System.out.println("Filename detected : " + fName); + logger.log("INFO", "Filename detected : " + fName); return true; } diff --git a/src/FileDownloader.java b/src/FileDownloader.java index fc323344a..90ee9b9db 100644 --- a/src/FileDownloader.java +++ b/src/FileDownloader.java @@ -3,7 +3,6 @@ import java.net.SocketTimeoutException; import java.net.URL; import java.net.URLConnection; -import java.nio.Buffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; @@ -54,17 +53,14 @@ public void run() { } } try { - //If link is from youtube - if (Drifty_CLI.isYoutubeURL(link)) { + //If link is from YouTube + if (Drifty_CLI.isYoutubeLink(link)) { //download youtube video - System.out.println("Downloading from youtube...."); - System.out.println("Directory: " + dir); + System.out.println("Downloading ..."); + Drifty_CLI.logger.log("INFO", "Downloading ..."); try { - Runtime runtime = Runtime.getRuntime(); - ProcessBuilder processBuilder = new ProcessBuilder("yt-dlp", "-P", dir, link); - processBuilder.directory(new File(dir)); - + ProcessBuilder processBuilder = new ProcessBuilder("yt-dlp", "-q", "--progress", "-P", dir, link); Process yt_dlp = processBuilder.start(); BufferedReader br = new BufferedReader(new InputStreamReader(yt_dlp.getInputStream())); @@ -74,8 +70,10 @@ public void run() { } } catch (Exception e) { e.printStackTrace(); + Drifty_CLI.logger.log("ERROR", e.getMessage()); } - //System.exit(0); + System.out.println("Successfully downloaded the file."); + Drifty_CLI.logger.log("INFO", "Successfully downloaded the file"); } else { url = new URL(link); diff --git a/yt-dlp.exe b/yt-dlp.exe new file mode 100644 index 000000000..11f8907b4 Binary files /dev/null and b/yt-dlp.exe differ