Example #1
0
        public static EpisodeInfo GetFileInfo(string path)
        {
            var episodeInfo = new EpisodeInfo(false);

            if (!ValidTypes.Contains(Path.GetExtension(path)))
            {
                return(episodeInfo);
            }

            foreach (var tempEpisodeInfo in _usableFunctions.Select(function => function(path)).Where(tempEpisodeInfo => tempEpisodeInfo))
            {
                episodeInfo = tempEpisodeInfo;
                break;
            }

            return(episodeInfo);
        }
Example #2
0
        private static EpisodeInfo DefaultNameStructure(string path)
        {
            var fInfo = new EpisodeInfo();

            foreach (var regexString in ShowRegexes)
            {
                string name;
                int    season;
                int    episode;

                var regex   = new Regex(regexString);
                var matches = regex.Match(path);

                if (matches.Length < 1)
                {
                    //nothing to match, nothing to update the info with
                    continue;
                }

                try {
                    name    = matches.Groups[1].ToString();
                    season  = Convert.ToInt32(matches.Groups[2].ToString());
                    episode = Convert.ToInt32(matches.Groups[3].ToString());
                }
                catch {
                    continue;
                }

                fInfo.SetValues(path, name, season, episode);

                if (!fInfo)
                {
                    continue;
                }

                fInfo.TrimName();
                return(fInfo);
            }

            return(fInfo);
        }