예제 #1
0
            public bool RGP(int PageNum = 1)
            {
                string url = "http://rgporn.com/index.php?newsid=" + PageNum;
                //tel.Update(txtURL, url);

                string html = web.DownloadHTML(url);

                if (html == "")
                {
                    return(false);
                }

                resultLines = xml.Parse_HTML_XML(html, "//body/div/div/div/div/table/tbody/tr/td/div/div/div/p");  // extract sections of text from html xml

                // extract tags
                string        display = "TAGS: ";
                List <string> tags    = new List <string>();
                string        Tags    = "";

                foreach (string line in resultLines)
                {
                    if (line.Contains("=tags"))
                    {
                        string tag = line.Replace("<a", "");
                        tag = tag.Replace("</a>", "");
                        tag = ahk.StringSplit(tag, ">", 1);
                        tag = tag.Trim();
                        tags.Add(tag);

                        display = display + "\n" + tag;

                        if (Tags != "")
                        {
                            Tags = Tags + "|" + tag;
                        }
                        if (Tags == "")
                        {
                            Tags = tag;
                        }
                    }
                }

                // extract title
                List <string> titleLines = xml.Parse_HTML_XML(html, "//body/div/div/div/div/table/tbody/tr/td/div/div/div");  // extract sections of text from html xml
                string        title      = lst.Return_List_Value(titleLines, 2);

                title = title.Replace("<h1 class=\"shead\">", "");
                title = title.Replace("</h1>", "");

                string imagehtml = "";

                foreach (string ima in titleLines)
                {
                    if (ima.Contains(".jpg"))
                    {
                        imagehtml = imagehtml + "\n" + ima;
                    }
                }

                //ahk.MsgBox(title);

                List <string> links = rg.Regex_RGLinks(html);

                bool   AllOnline       = true;
                int    onlineLinkCount = 0;
                string linkText        = "";

                foreach (string link in links)
                {
                    RGInfo info = rg.RapidGatorCheckStatus(link);

                    if (!info.FileOnline)
                    {
                        AllOnline = false;
                    }
                    else
                    {
                        onlineLinkCount++;
                    }

                    string wlink = link + "|" + info.FileSize;

                    if (linkText != "")
                    {
                        linkText = linkText + "\n" + wlink;
                    }
                    if (linkText == "")
                    {
                        linkText = wlink;
                    }
                }

                string linksMsg = onlineLinkCount + "/" + links.Count + " Links Online";

                // Extract / Display Images From Page
                int downloaded = 0;

                if (AllOnline)
                {
                    string SaveDir = ahk.AppDir() + "\\Posts\\RGP\\" + ahk.AddLeadingZeros(PageNum, 5).ToString();
                    ahk.FileCreateDir(SaveDir);
                    ahk.Sleep(500);

                    ahk.FileAppend(Tags, SaveDir + "\\Tags.txt");
                    ahk.FileAppend(title, SaveDir + "\\Title.txt");
                    ahk.FileAppend(linkText, SaveDir + "\\Links.txt");

                    downloaded = DownloadImages(imagehtml, SaveDir, ahk.AddLeadingZeros(PageNum, 5).ToString());

                    //tel.Update(txtResults, "Title: " + title + "\n\nTags: " + Tags + "\n\n" + linksMsg);
                }


                //ahk.MsgBox("Found " + links.Count + " Links\nDownloaded " + downloaded.ToString() + " + Images");


                return(AllOnline);
            }
예제 #2
0
            // takes tiled screen shot to generate a single preview image - returns path to new preview image (blank if failed)
            public string VidCap_Tiles(string videoFilePath, string saveDir = "", int TilesWide = 3, int TilesTall = 3, string Scale = "320:240", string SaveFormat = "jpg", string CaptureOpt = "1000")
            {
                if (!ahk.isVideo(videoFilePath))
                {
                    sb(videoFilePath + " Not Recognized Video Format... Skipping");
                    return("");
                }

                VideoFile vidInfo = GetVideoInfo(videoFilePath);

                // Extract FPS From video Info returned

                //h264(Main)(avc1 / 0x31637661), yuv420p, 600x450, 750 kb / s, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc(default)



                int seconds      = vidInfo.Duration.TotalSeconds.ToInt(); //getDuration(videoFilePath);
                int egs          = TilesWide * TilesTall;                 // ex 3 x 3 = 9 segs - dfivide total time by 9 for even timing
                int shotDistance = seconds / egs;

                //TimeSpan t = TimeSpan.FromMilliseconds(shotDistance);
                TimeSpan t = TimeSpan.FromSeconds(shotDistance);

                int MinBetween            = t.Minutes; // # of minutes between tile shots (in video)
                int SecondsBetween        = t.Seconds; // # of seconds between tile shots (in video)
                int distanceBetweenFrames = (seconds * vidInfo.FPS).ToInt();

                //string SaveFormat = "jpg";
                //Scale = "0:0";
                int FrameCount = 1;

                //Scale = "320:240";

                //int TileX = 2;
                //int TileY = 3;
                //string Scale = "320:240";
                //string[] shots = new string[numShots];

                // default save dir under neath original file
                if (saveDir == "")
                {
                    saveDir = ahk.FileDir(videoFilePath) + "\\Previews";
                }

                string outImage = saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "." + SaveFormat;

                if (File.Exists(outImage))
                {
                    return("");
                }


                outImage = saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "_%03d" + SaveFormat;

                ahk.FileCreateDir(saveDir);

                string args = "";
                string opt  = CaptureOpt;



                //-i video.mkv -vf scale=500:-1 -t 10 -r 10 image.gif

                // one every 1000 frames, works but didn't alway fill all the boxes
                if (opt == "1000")
                {
                    args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -frames: " + FrameCount + " -vf \"select=not(mod(n\\,1000)),scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";
                }

                // one every 3000 frames - works but SLOWER
                if (opt == "3000")
                {
                    args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf \"select=not(mod(n\\,3000)),scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";
                }

                //string args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf \"-r 0.0033,scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";
                //string args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf \"select=not(mod(n\\,3500)),scale=" + Scale + ",tile=" + TilesWide + "x" + TilesTall + "\" \"" + outImage + "\"";

                // one frame per video (thumbnails no rows)
                if (opt == "1")
                {
                    args = " -ss 00:" + MinBetween + ":" + SecondsBetween + " -i \"" + videoFilePath + "\" -vf thumbnail,scale=" + Scale + " -frames:v 1 \"" + outImage + "\"";
                }

                // export ALL action frames (about 1K images in 40min example video)
                if (opt == "ActionFrames")
                {
                    args = "-i \"" + videoFilePath + "\" -vf \"select = 'eq(pict_type,PICT_TYPE_I)'\" -vsync vfr \"" + saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "_%04d." + SaveFormat + "\"";
                }

                // One screen shot at specific time stamp
                if (opt == "TimeShot")
                {
                    args = " -i \"" + videoFilePath + "\" -ss 00:02:05.000 -vframes 1 \"" + saveDir + "\\" + ahk.FileNameNoExt(videoFilePath) + "." + SaveFormat + "\"";
                }

                // mosasic option - works
                if (opt == "Mosasic")
                {
                    args = " -i \"" + videoFilePath + "\" -vf select='gt(scene\\,0.5)',scale=" + Scale + ",tile -frames:v 5  \"" + outImage + "\"";
                }


                //args = "-ss 3 -i \"" + videoFilePath + "\" -vf \"select = gt(scene\\, 0.5)\" -frames:v 5 -vsync vfr \"" + outImage + "\"";
                //args = "-i \"" + videoFilePath + "\" -vf  \"select = gt(scene\\, 0.4),scale = 640:360\" -frames:v 5 \"" + outImage + "\"";
                //args = "-i \"" + videoFilePath + "\" -vf fps=1/60 \"" + outImage + "\""; // one image per minute
                //int dur = getDuration(videoFilePath);
                // 2,266 = 37 min video


                string FPS = "";  // number of frames to capture

                try
                {
                    int totalFPS = vidInfo.Duration.TotalSeconds.ToInt() / 10;  // divide total seconds by 10
                    FPS = "1/" + totalFPS.ToString();
                }
                catch { FPS = "1/60"; }  // 1 frame per min



                args = "-i \"" + videoFilePath + "\" -vf fps=" + FPS + " \"" + outImage + "\""; //


                ahk.FileAppend(videoFilePath, ahk.AppDir() + "\\FFMpeg_Log.txt");
                StartFFMpeg(args);


                if (File.Exists(outImage))
                {
                    return(outImage);
                }
                else
                {
                    return("");
                }
            }
예제 #3
0
        // #region === FileFolder ===

        /// <summary>Writes text to the end of a file (first creating the file, if necessary).</summary>
        /// <param name="Text">The text to append to the file. This text may include linefeed characters (`n) to start new lines.</param>
        /// <param name="FileName">The name of the file to be appended, which is assumed to be in %A_WorkingDir% if an absolute path isn't specified.</param>
        /// <param name="Mode">Mode 0 = Default using AHK FileAppend command | Mode 1 = Using StreamWriter to write Text</param>
        public static bool FileAppend(this string Text, string FileName, int Mode = 1)
        {
            _AHK ahk = new _AHK();

            return(ahk.FileAppend(Text, FileName, Mode));
        }
예제 #4
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);
            }