Пример #1
0
        private static void GetSubsForTorrent(Video video, string videoName, string targetFolder, string tempFolder, bool searchInComments = false)
        {
            var subDivXManager = new SubDivXManager();
            var subs = subDivXManager.GetCandidateSubs(video, searchInComments, cache);

            if (subs.Any())
            {
                if (autoDownload)
                {
                    Console.WriteLine("Autodownload is enabled, downloading first sub.");
                    Download(video, videoName, targetFolder, tempFolder, subDivXManager, subs.First());
                }
                else
                {
                    Console.WriteLine("Showing list of matching subtitles, double-click to download");
                    var selectedSub = FrmShowSubs.SelectSub(subs);
                    if (selectedSub != null)
                    {
                        Download(video, videoName, targetFolder, tempFolder, subDivXManager, selectedSub);
                    }
                }
            }
            else
            {
                if (!searchInComments)
                {
                    Console.WriteLine("No subs were found. Searching for release group within comments.");
                    GetSubsForTorrent(video, videoName, targetFolder, tempFolder, true);
                }
                else
                {
                    Console.WriteLine("No subs were found. Do you want to specify search values? (Y/N)");
                    var key = Console.ReadKey();
                    Console.WriteLine();

                    if (key.KeyChar == 'Y' || key.KeyChar == 'y')
                    {
                        video = FrmVideoInfo.GetVideoInfo(video);
                        if (video != null)
                        {
                            GetSubsForTorrent(video, videoName, targetFolder, tempFolder);
                        }
                    }
                }
            }
        }