Ejemplo n.º 1
0
        public List <FolderInfo> GetFolders()
        {
            List <FolderInfo> folders = new List <FolderInfo>();

            PathConverter pathConverter = PathConverter.GetInstance();

            if (!pathConverter.IsValidPath(this.virtualAddress))
            {
                this.virtualAddress = pathConverter.CorrectPath(this.virtualAddress);
            }

            List <string> folderPaths = pathConverter.GetFoldersPhysicalPathInVirtual(this.virtualAddress);

            foreach (var path in folderPaths)
            {
                if (settings.FolderFilter.Test(path))
                {
                    FolderInfo folderInfo = new FolderInfo(path, false);
                    folders.Add(folderInfo);
                }
            }

            folders = pathConverter.SortByNumeric <FolderInfo>(folders);

            return(folders);
        }
Ejemplo n.º 2
0
        public List <FolderInfo> GetFiles()
        {
            List <FolderInfo> folders = new List <FolderInfo>();

            PathConverter pathConverter = PathConverter.GetInstance();
            List <string> folderPaths   = pathConverter.GetFilesPhysicalPathInVirtual(this.virtualAddress);

            folderPaths = pathConverter.SortByNumeric(folderPaths);

            String physicalPath = pathConverter.ConvertToPhysicalPath(this.virtualAddress);

            SeasonInfo parser = new SeasonInfo(physicalPath);

            foreach (var path in folderPaths)
            {
                if (settings.FileFilter.Test(path))
                {
                    FolderInfo folderInfo = new FolderInfo(path, true);

                    foreach (var episode in parser.Episodes)
                    {
                        if (Path.GetFileNameWithoutExtension(folderInfo.FolderName) == episode.Filename)
                        {
                            string imgVirtPath = String.Format("{0}/metadata/{1}", this.virtualAddress, episode.EpisodeImage.ImagePhysicalPath);

                            String imgPhysPath = pathConverter.ConvertToPhysicalPath(imgVirtPath);

                            if (!File.Exists(imgPhysPath))
                            {
                                imgVirtPath = "Resources/unknown.jpg";
                            }

                            folderInfo.FolderImage.ImagePhysicalPath = imgVirtPath;
                            folderInfo.FolderDiplayName  = String.Format("{0}) {1}", episode.EpisodeNumber, episode.EpisodeName);
                            folderInfo.Overview          = episode.EpisodeOverview;
                            folderInfo.SubtitleLanguages = episode.SubtitleLanguages;
                            break;
                        }
                    }

                    folders.Add(folderInfo);
                }
            }

            return(folders);
        }