public IList<EpisodeType> GetMovies(string sourcePath)
        {
            var fileTypeValues = Settings.Default.FileTypes.Split('|');

            var fileList = new ArrayList();

            foreach (var fileTypeValue in fileTypeValues)
            {
                var di = Directory.GetFiles(sourcePath, string.Format("*.{0}", fileTypeValue),
                                            SearchOption.AllDirectories);

                fileList.AddRange(di);
            }

            IList<EpisodeType> movieList = new List<EpisodeType>();

            foreach (string file in fileList)
            {
                var episodeType = new EpisodeType();
                var fileName = Path.GetFileName(file);

                if (string.IsNullOrEmpty(fileName))
                    continue;

                if (fileName.ToLower().Contains("sample"))
                    continue;

                var checker = BootStrapper.ResolveAll<IEpisodeChecker>();
                Tuple<string, string> result = null;

                foreach (var c in checker)
                {
                    result = c.CheckSeasonEpisode(CleanName(fileName));
                    if (result != null)
                        break;
                }

                if (result != null)
                    continue;

                episodeType.FileName = fileName;
                episodeType.FullPath = file;
                episodeType.FileSize = Math.Round((((double)new FileInfo(file).Length) / 1048576), 2).ToString();

                movieList.Add(episodeType);
            }
            return movieList;
        }
Example #2
0
        public IList<EpisodeType> GetSourceEpisode(string sourcePath, string fileType)
        {
            var di = Directory.GetFiles(sourcePath, "*.avi", SearchOption.AllDirectories);
            var di2 = Directory.GetFiles(sourcePath, "*.mkv", SearchOption.AllDirectories);
            var l = new ArrayList(di);
            l.AddRange(di2);

            IList<EpisodeType> episode = new List<EpisodeType>();

            foreach (string file in l)
            {
                var episodeType = new EpisodeType();
                var fileName = Path.GetFileName(file);

                if(string.IsNullOrEmpty(fileName))
                    continue;

                if(fileName.ToLower().Contains("sample"))
                    continue;

                var checker = BootStrapper.ResolveAll<IEpisodeChecker>();
                Tuple<string, string> result = null;

                foreach (var c in checker)
                {
                    result = c.CheckSeasonEpisode(fileName);
                    if (result != null)
                        break;
                }

                if (result == null)
                    continue;
                var seasonString = result.Item1;
                var episodeString = result.Item2;

                var fName = fileName.Replace(seasonString, "");
                fName = fName.Replace(episodeString, "");

                episodeType.FileName = fName;
                episodeType.Season = seasonString;
                episodeType.Episode = episodeString;
                episodeType.FullPath = file;
                episodeType.FileSize = Math.Round((((double)new FileInfo(file).Length) / 1048576), 2).ToString();

                episode.Add(episodeType);
            }
            return episode;
        }
 private void ExecuteAddMapping(object obj)
 {
     _selectedFile = null;
     if (!CurrentMappings.ContainsKey(Name))
     {
         CurrentMappings.Add(Name, NewName);
         _episodeService.WriteMappingValue(_currentMappings);
     }
     PropertyChanged(this, new PropertyChangedEventArgs("CurrentMappings"));
     UpdateFileLists();
 }
Example #4
0
 private void ExecuteAddMapping(object obj)
 {
     _selectedFile = null;
     CurrentMappings.Add(Name, NewName);
     _episodeService.WriteMappingValue(_currentMappings);
     PropertyChanged(this, new PropertyChangedEventArgs("CurrentMappings"));
     PropertyChanged(this, new PropertyChangedEventArgs("NewFileList"));
 }