Esempio n. 1
0
        private int ExecuteSecondPass(AnalyseVideo analyseVideo, ParallelLoopState loopState, int currentPass)
        {
            //pass2 (remove prefix / suffixes)
            if (analyseVideo.Candidates.Count == 0 || analyseVideo.MatchPercentage < Constants.GREAT_MATCH_FOUND_TRESHOLD)
            {
                string fileNameGuess   = analyseVideo.GetMainFileNameGuess();
                string folderNameGuess = analyseVideo.GetMainFolderNameGuess();

                string fileName = Path.GetFileNameWithoutExtension(analyseVideo.Video.Files[0].Path);
                if (fileName != null)
                {
                    List <string> fileNameGuesses = VideoTitleExtractor.GetTitleGuessesFromString(fileName.ToLower(), true);
                    analyseVideo.AddTitleGuesses(fileNameGuesses);
                }
                var directoryName = Path.GetDirectoryName(analyseVideo.Video.Files[0].Path);
                if (directoryName != null)
                {
                    string        folderName        = directoryName.Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar).Last().ToLower();
                    List <string> folderNameGuesses = VideoTitleExtractor.GetTitleGuessesFromString(folderName, true);
                    analyseVideo.AddTitleGuesses(folderNameGuesses);
                }

                FillCandidates(analyseVideo, fileNameGuess, folderNameGuess);
            }
            analyseVideo.HandledTitleGuesses();
            ExecuteAfterPass(currentPass);

            //if (CancellationPending)
            //{
            //	e.Cancel = true;
            //	return;
            //}
            return(currentPass);
        }
Esempio n. 2
0
        private int ExecuteFirstPassMain(AnalyseVideo analyseVideo, ParallelLoopState loopState, int currentPass)
        {
            //TODO 070 split up in different analysing passes --> only reanalyse videos where no good match was found (or selected by user)

            string fileNameGuess   = analyseVideo.GetMainFileNameGuess();
            string folderNameGuess = analyseVideo.GetMainFolderNameGuess();

            FillCandidates(analyseVideo, fileNameGuess, folderNameGuess);

            analyseVideo.HandledTitleGuesses();
            ExecuteAfterPass(currentPass);

            //if (CancellationPending)
            //{
            //	e.Cancel = true;
            //}
            return(currentPass);
        }
Esempio n. 3
0
        private int ExecuteThirdPass(AnalyseVideo analyseVideo, ParallelLoopState loopState, int currentPass)
        {
            if (analyseVideo.Candidates.Count == 0 || analyseVideo.MatchPercentage < Constants.GREAT_MATCH_FOUND_TRESHOLD)
            {
                analyseVideo.AddTitleGuesses(VideoTitleExtractor.GetTitleGuessesFromPath(analyseVideo.Video.Files[0].Path));
                //TODO 004 optimize this --> also gets done in pass1 --> remember somehow
                UniqueList <string> titleGuesses = analyseVideo.GetTitleGuesses();

                string fileNameGuess   = analyseVideo.GetMainFileNameGuess();
                string folderNameGuess = analyseVideo.GetMainFolderNameGuess();

                titleGuesses.Clear();
                foreach (string searchResult in BingSearch.Search(fileNameGuess))
                {
                    analyseVideo.AddTitleGuesses(VideoTitleExtractor.CleanTitle(searchResult));
                }

                if (folderNameGuess != null)
                {
                    foreach (string searchResult in BingSearch.Search(folderNameGuess))
                    {
                        analyseVideo.AddTitleGuesses(VideoTitleExtractor.CleanTitle(searchResult));
                    }
                }

                FillCandidates(analyseVideo, fileNameGuess, folderNameGuess);
            }

            analyseVideo.HandledTitleGuesses();
            ExecuteAfterPass(currentPass);
            //if (CancellationPending)
            //{
            //	e.Cancel = true;
            //	return;
            //}
            return(currentPass);
        }