コード例 #1
0
ファイル: Main.cs プロジェクト: toycodes/AvRenamer
        private void doWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker       bw      = sender as BackgroundWorker;
            JavLibraryScraper      scraper = new JavLibraryScraper();
            List <ExtractorResult> results = CodeExtractor.extractFolder(DownloadFolderPath.Text);

            foreach (ExtractorResult er in results)
            {
                try
                {
                    if (er.recommandCode == "")
                    {
                        continue;
                    }
                    string[]  name       = er.recommandCode.Split('.');
                    MoiveInfo info       = scraper.getMoiveInfoByIdentifyCode(name[0]);
                    string    actor_list = string.Join(",", info.Actors);
                    actor_list = "[" + actor_list + "]";
                    string genres = string.Join(",", info.Tags);
                    genres = "[" + genres + "]";
                    string leftName = "";
                    for (int i = 1; i < name.Length; i++)
                    {
                        leftName += "." + name[i];
                    }
                    string destFile = WorkingFolderPath.Text + "\\" + getAllowedFileName(info.Name + actor_list + genres + leftName) + Path.GetExtension(er.filePath);
                    er.destName = destFile;
                    File.Move(er.filePath, er.destName);
                    bw.ReportProgress(0, er);
                }
                catch
                {
                    continue;
                }
            }
            bw.ReportProgress(100);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: toycodes/AvRenamer
        private void GetImages_Click(object sender, EventArgs e)
        {
            GetImageData.Enabled = false;
            JavLibraryScraper      scraper = new JavLibraryScraper();
            List <ExtractorResult> results = CodeExtractor.extractFolder(WorkingFolderPath.Text);

            foreach (ExtractorResult er in results)
            {
                try
                {
                    if (er.recommandCode == "")
                    {
                        continue;
                    }
                    string[]  name = er.recommandCode.Split('.');
                    MoiveInfo info = scraper.getMoiveInfoByIdentifyCode(name[0]);
                    while (true)
                    {
                        try
                        {
                            info.imgData = downloadImgData(info.imgUrl);
                            break;
                        }
                        catch
                        {
                            continue;
                        }
                    }
                }
                catch
                {
                    continue;
                }
            }
            GetImageData.Enabled = true;
        }