Skip to content

Commit

Permalink
check if the link is playlist before ask
Browse files Browse the repository at this point in the history
  • Loading branch information
awidesky committed May 7, 2021
1 parent bd90cab commit 60d4ce1
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions src/com/awidesky/YoutubeClipboardAutoDownloader/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,18 @@ private static void checkClipBoard() {
return;

if (Config.getClipboardListenOption().equals("Ask when a link is found")) {

SwingUtilities.invokeLater(() -> {

if (!GUI.confirm("Download link in clipboard?", "Link : " + data)) {

Main.log("\n[GUI.linkAcceptChoose] Download link " + data + "? : " + false + "\n");

} else {

Main.log("\n[GUI.linkAcceptChoose] Download link " + data + "? : " + true + "\n");
Arrays.stream(data.split("\n")).forEach(Main::submitDownload);

}

});


if (!GUI.confirm("Download link in clipboard?", "Link : " + data)) {

Main.log("\n[GUI.linkAcceptChoose] Download link " + data + "? : " + false + "\n");

} else {

Main.log("\n[GUI.linkAcceptChoose] Download link " + data + "? : " + true + "\n");
Arrays.stream(data.split("\n")).forEach(Main::submitDownload);

}

return;
}

Expand Down Expand Up @@ -202,7 +198,7 @@ private static void submitDownload(String data) {

PlayListOption p = Config.getPlaylistOption();

if (p == PlayListOption.ASK) {
if (data.contains("list=") && p == PlayListOption.ASK) {
p = (GUI.confirm("Download entire Playlist?", "Link : " + url)) ? PlayListOption.YES : PlayListOption.NO;
}

Expand All @@ -222,8 +218,7 @@ private static void submitDownload(String data) {
}

} else {
GUI.error("[Task" + num + "|validating] " + "Not a valid url!",
data + "\nis not valid or unsupported url!", null);
GUI.error("[Task" + num + "|validating] " + "Not a valid url!", data + "\nis not valid or unsupported url!", null);
return;
}

Expand Down

0 comments on commit 60d4ce1

Please sign in to comment.