Ejemplo n.º 1
0
            public void RAR_EachFileInDir(RadProgressBar radProgress, string DirPath, bool NewThread = true, bool EpNumRARName = true, string Prefix = "")
            {
                _AHK ahk = new _AHK();

                if (NewThread)
                {
                    Thread imdbTVParseThread = new Thread(() => RAR_EachFileInDir(radProgress, DirPath, false, EpNumRARName, Prefix));
                    imdbTVParseThread.Start();
                }
                else
                {
                    _TelerikLib.RadProgress pro = new _TelerikLib.RadProgress();
                    _Lists lst = new _Lists();
                    _Parse prs = new _Parse();

                    string rar = @"C:\_Code\LucidProjects\ADBindex\ComPress\bin\Debug\Lib\rar.exe";

                    List <string> files = lst.FileList(DirPath);

                    pro.SetupProgressBar(radProgress, files.Count);

                    string RelativePath = "-ep";

                    string fileDir = ahk.FileDir(DirPath); int i = 0;
                    foreach (string file in files)
                    {
                        if (ahk.FileExt(file).ToUpper() == ".URL")
                        {
                            continue;
                        }


                        // extract season/ep number from file name
                        string epNum = prs.SeasonEpNums(file);

                        i++; pro.UpdateProgress(radProgress, ahk.FileName(file) + " " + i + "/" + files.Count);
                        string newRAR = fileDir + "\\" + Prefix + epNum + ".rar";

                        // use the file name as the zip file name
                        if (!EpNumRARName)
                        {
                            newRAR = fileDir + "\\" + ahk.FileNameNoExt(file) + ".rar";
                        }

                        if (File.Exists(newRAR))
                        {
                            continue;
                        }


                        string FIle = file.Replace(",", "`,");

                        string cmd = rar + " A -m0 " + RelativePath + " " + "\"" + newRAR + "\" \"" + FIle + "\"";
                        ahk.RunWait(cmd, "", "Hide");
                    }

                    ahk.MsgBox("Finished RARing " + files.Count + " Files");
                }
            }
Ejemplo n.º 2
0
            //_Parse.XML xml = new _Parse.XML();
            //_AHK ahk = new _AHK();
            //_Database.SQL sql = new _Database.SQL();
            //_Lists lst = new _Lists();
            //_Parse prs = new _Parse();
            ////_Images img = new _Images();
            //_TelerikLib.RadProgress pro = new _TelerikLib.RadProgress();
            //_TelerikLib tel = new _TelerikLib();
            ////_Apps.Chrome cr = new _Apps.Chrome();
            //sharpAHK_Dev._Threads thr = new sharpAHK_Dev._Threads();
            //_TelerikLib.RadTree tree = new _TelerikLib.RadTree();
            //IAFD iafd = new IAFD();
            //_Web.ADBSites.PBBForum pbb = new _Web.ADBSites.PBBForum();
            //_Web.ADBSites.PRNWForum prnw = new _Web.ADBSites.PRNWForum();

            #endregion


            public void Download_Site(int startPage = 1, int LastPage = 230, bool SkipExisting = true, RadProgressBar Bar = null, RadProgressBar Bar2 = null, bool NewThread = true)
            {
                _AHK   ahk = new _AHK();
                _Lists lst = new _Lists();

                _Sites.RapidGator       rg  = new _Sites.RapidGator();
                _TelerikLib.RadProgress pro = new _TelerikLib.RadProgress();

                if (NewThread)
                {
                    Thread newThread = new Thread(() => Download_Site(startPage, LastPage, SkipExisting, Bar, Bar2, false)); // Function To Execute
                    newThread.IsBackground = true;
                    newThread.Start();
                }
                else
                {
                    int pageNum = startPage;
                    do
                    {
                        int           postNum = 0;
                        string        html    = ahk.Download_HTML("http://pornchil.com/page/" + pageNum + "/");
                        List <string> lines   = lst.Text_To_List(html, true, true, false);

                        if (Bar != null)
                        {
                            pro.SetupProgressBar(Bar, 10);
                        }                                                    // # of posts/page

                        foreach (string line in lines)
                        {
                            if (line.Contains("<h1 class=\"entry-title\"><a href="))
                            {
                                PrnChill chill = new PrnChill();
                                //ahk.MsgBox(line);

                                string Line = line.Replace("<h1 class=\"entry-title\"><a href=\"", "");
                                chill.PostURL  = ahk.StringSplit(Line, "\"", 0);
                                chill.PostName = ahk.StringSplit(Line, ">", 1);
                                chill.PostName = ahk.StringSplit(chill.PostName, "<", 0);

                                if (SkipExisting)
                                {
                                    if (AlreadyParsed(chill.PostURL))
                                    {
                                        continue;
                                    }                                                // check to see if this post already has an entry, if so skip
                                }


                                if (Bar != null)
                                {
                                    postNum++; pro.UpdateProgress(Bar, postNum + "/10");
                                }                                                                          // # of posts remaining

                                string        postHTML = ahk.Download_HTML(chill.PostURL);
                                List <string> links    = rg.Regex_RGLinks(postHTML);

                                if (links.Count > 0)
                                {
                                    if (Bar != null)
                                    {
                                        pro.ProgressText(Bar, postNum + "/10 | Verifying Links");
                                    }                                                                                           // # of posts remaining

                                    List <_Sites.RapidGator.RGInfo> checkedLinks = rg.RapidGator_BatchCheck(links, true, Bar2); // batch check list of rg links

                                    string rglinks = ""; int goodLinkCount = 0;
                                    foreach (_Sites.RapidGator.RGInfo link in checkedLinks)
                                    {
                                        if (rglinks == "")
                                        {
                                            rglinks = link.FileURL + "|" + link.FileSize; goodLinkCount++;
                                        }
                                        else
                                        {
                                            rglinks = rglinks + "\n" + link.FileURL + "|" + link.FileSize; goodLinkCount++;
                                        }
                                    }

                                    chill.Links     = rglinks; // online rg links with  filepath|filesize return
                                    chill.LinkCount = goodLinkCount;

                                    chill.LinkCheckDate = DateTime.Now.ToString();
                                }

                                chill.InCollection = "false";

                                List <string> images = rg.JpgImageLinks(postHTML);

                                if (Bar != null)
                                {
                                    pro.ProgressText(Bar, postNum + "/10 | Downloading Images (" + images.Count + ")");
                                }                                                                                                         // # of posts remaining

                                if (images.Count > 0)
                                {
                                    // create save dir
                                    string saveDir = ahk.AppDir() + "\\PrnChillPosts";
                                    ahk.FileCreateDir(saveDir);
                                    saveDir = saveDir + "\\" + chill.PostName;
                                    ahk.FileCreateDir(saveDir);

                                    chill.ImageDir = saveDir;

                                    int imgNum = 1;
                                    foreach (string image in images)
                                    {
                                        ahk.Download_File(image, saveDir + "\\" + imgNum + ".jpg", true); imgNum++;
                                    }
                                }

                                PrnChill_UpdateInsert(chill);
                            }
                        }

                        pageNum++;
                    } while (pageNum <= LastPage);
                }
            }