コード例 #1
0
        protected override List <BaseItem> GetNonCachedChildren()
        {
            //build our list of trailers
            var validChildren   = new List <BaseItem>();
            var actualMovieRefs = new List <string>();

            foreach (Folder folder in Kernel.Instance.RootFolder.Children)
            {
                if (folder != this && folder is Folder)
                {
                    foreach (BaseItem item in folder.AllRecursiveChildren)
                    {
                        if (item is Movie)
                        {
                            Movie movie = item as Movie;
                            if (movie.ContainsTrailers && !actualMovieRefs.Contains(movie.Path.ToLower()))
                            {
                                //create our movie item
                                MovieTrailer trailer = new MovieTrailer();
                                //now assign the id and fill in essentials - pointing to trailer as actual movie
                                trailer.Id          = ("MBTrailers.MovieTrailer" + movie.TrailerFiles.First().ToLower()).GetMD5();
                                trailer.RealMovieID = movie.Id;
                                trailer.Overview    = movie.Overview;
                                trailer.Genres      = movie.Genres;
                                trailer.MpaaRating  = movie.MpaaRating;
                                trailer.Path        = movie.TrailerFiles.First();
                                trailer.MediaType   = MediaTypeResolver.DetermineType(trailer.Path);
                                trailer.Parent      = this;
                                //and add to our children
                                validChildren.Add(trailer);
                                actualMovieRefs.Add(movie.Path.ToLower()); //we keep track so we don't get dups
                            }
                        }
                    }
                }
            }
            return(validChildren);
        }
コード例 #2
0
        protected override List<BaseItem> GetNonCachedChildren()
        {
            //build our list of trailers
            var validChildren = new List<BaseItem>();
            var actualMovieRefs = new List<string>();

            foreach (Folder folder in Kernel.Instance.RootFolder.Children)
            {
                if (folder != this && folder is Folder) {
                    foreach (BaseItem item in folder.AllRecursiveChildren)
                    {
                        if (item is Movie)
                        {
                            Movie movie = item as Movie;
                            if (movie.ContainsTrailers && !actualMovieRefs.Contains(movie.Path.ToLower()))
                            {
                                //create our movie item
                                MovieTrailer trailer = new MovieTrailer();
                                //now assign the id and fill in essentials - pointing to trailer as actual movie
                                trailer.Id = ("MBTrailers.MovieTrailer" + movie.TrailerFiles.First().ToLower()).GetMD5();
                                trailer.RealMovieID = movie.Id;
                                trailer.Overview = movie.Overview;
                                trailer.Genres = movie.Genres;
                                trailer.MpaaRating = movie.MpaaRating;
                                trailer.Path = movie.TrailerFiles.First();
                                trailer.Parent = this;
                                //and add to our children
                                validChildren.Add(trailer);
                                actualMovieRefs.Add(movie.Path.ToLower()); //we keep track so we don't get dups
                            }
                        }
                    }
                }
            }
            return validChildren;
        }