Example #1
0
            public void WriteDownloadLink(string LinkURL, string PackageName = "TV")
            {
                if (DownloadRootPath == null)
                {
                    ahk.MsgBox("Must Define JDownloader Download Root Path First"); return;
                }
                if (FolderWatchPath == null)
                {
                    ahk.MsgBox("Must Define JDownloader FolderWatch Path First"); return;
                }

                string linkURL  = LinkURL;
                string fileName = prs.LinkFileName(linkURL).Replace(".html", "");
                string showName = PackageName;


                string DLDir = DownloadRootPath;
                bool   ExtractAfterDownload = true;
                bool   Enabled     = true;
                bool   AutoStart   = true;
                bool   ForcedStart = true;
                bool   AutoConfirm = true;

                //#this is a property file format. You can put all these entries in a jsonarray [{..},{...}] as well.
                //#save this as myFile.crawljob
                //#Start a new entry with anything but a comment (#...) or key=. An empty line would be ok as well
                //#\ must be double encoded! \ -> \\
                //->NEW ENTRY<-
                //   chunks = 6
                //#a comment
                //#   extractPasswords=["Password1","Password2"]
                //   text = https://rapidgator.net/file/3aef7553f517698dad4d6d0c5d505e17/The.China.Hustle.2017.WEB.x264-MUSiCANA.mkv
                //   filename = The.China.Hustle.2017.WEB.x264 - MUSiCANA.mkv
                //   packageName = ShowName
                //   extractAfterDownload = TRUE
                //   downloadFolder = D:\\Media\\ThisShowName
                //# priority=DEFAULT
                //# forcedStart=UNSET
                //# downloadPassword=null
                //# use only if text contains one single link
                //# overwritePackagizerEnabled=true
                //# setBeforePackagizerEnabled=true
                //# comment=null
                //# deepAnalyseEnabled=true
                //# addOfflineLink=true
                //   enabled = true
                //   autoStart = TRUE
                //   forcedStart = TRUE
                //   autoConfirm = TRUE


                string lines = "# JDownloader FolderWatch Link";

                lines = lines + "\n" + "->NEW ENTRY<-";
                lines = lines + "\n" + "chunks=6";
                lines = lines + "\n" + "text=" + linkURL;

                // add missing file format?
                lines = lines + "\n" + "filename=" + fileName + ".mp4";

                lines = lines + "\n" + "packageName=" + showName;
                lines = lines + "\n" + "downloadFolder=" + DLDir + "\\" + showName;
                lines = lines + "\n" + "extractAfterDownload=" + ExtractAfterDownload.ToString();
                lines = lines + "\n" + "enabled=" + Enabled.ToString();
                lines = lines + "\n" + "autostart=" + AutoStart.ToString();
                lines = lines + "\n" + "forcedStart=" + ForcedStart.ToString();
                lines = lines + "\n" + "autoConfirm=" + AutoConfirm.ToString();
                lines = lines + "\n" + "";

                string saveName = fileName.Replace("|", "_");

                saveName = ahk.Decode(fileName);

                LinkCounter++;

                string savePath = FolderWatchPath + "\\" + LinkCounter + ".crawljob";

                ahk.FileAppend(lines, savePath);
            }