Beispiel #1
0
        public void GET_ALL_GENRES_WITH_COVERS()
        {
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> allGenres = TitleCollectionManager.GetAllGenres(null);

            foreach (FilteredCollection item in allGenres)
            {
                Console.WriteLine(item.Name + " " + item.ImagePath + " " + item.Count);
            }


            Console.WriteLine("Took: " + (DateTime.Now - start).TotalMilliseconds + " milliseconds");
        }
Beispiel #2
0
        public void TEST_GET_ALL_GENRES()
        {
            Console.WriteLine("Starting to get all genres");
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> items = TitleCollectionManager.GetAllGenres(null);

            foreach (FilteredCollection item in items)
            {
                Console.WriteLine(item.Name + " " + item.Count + " " + item.ImagePath);
            }

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            items.Count()));
        }
Beispiel #3
0
        public void TEST_GET_ALL_GENRES_GIVEN_FILTER()
        {
            Console.WriteLine("Starting to get all Tim Burton movie genres");
            DateTime start = DateTime.Now;

            List <TitleFilter> filter = new List <TitleFilter>();

            filter.Add(new TitleFilter(TitleFilterType.Person, "Tim Burton"));

            IEnumerable <FilteredCollection> items = TitleCollectionManager.GetAllGenres(filter);

            foreach (FilteredCollection item in items)
            {
                Console.WriteLine(item.Name + " " + item.Count);
            }

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            items.Count()));
        }
Beispiel #4
0
        public IList <GalleryItem> GetGalleryItems()
        {
            List <GalleryItem> items = new List <GalleryItem>();
            //items.Add(new GalleryItem(_gallery, AllItems, AllItems, this));

            IEnumerable <FilteredCollection> filteredItems = null;

            switch (filterType)
            {
            case TitleFilterType.Genre:
                filteredItems = TitleCollectionManager.GetAllGenres(existingFilters);
                //IEnumerable<FilteredCollectionWithImages> fc = TitleCollectionManager.GetAllGenresWithImages(existingFilters);
                //foreach (FilteredCollectionWithImages gen in fc)
                //{

                //}
                break;

            case TitleFilterType.ParentalRating:
                filteredItems = TitleCollectionManager.GetAllParentalRatings(existingFilters);
                break;

            case TitleFilterType.VideoFormat:
                filteredItems = TitleCollectionManager.GetAllVideoFormats(existingFilters);
                break;

            case TitleFilterType.Runtime:
                filteredItems = TitleCollectionManager.GetAllRuntimes(existingFilters);
                break;

            case TitleFilterType.Year:
                filteredItems = TitleCollectionManager.GetAllYears(existingFilters);
                break;

            case TitleFilterType.Country:
                filteredItems = TitleCollectionManager.GetAllCountries(existingFilters);
                break;

            case TitleFilterType.Tag:
                filteredItems = TitleCollectionManager.GetAllTags(existingFilters);
                break;

            case TitleFilterType.Director:
                filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Director);
                break;

            case TitleFilterType.Actor:
                filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Actor);
                break;

            case TitleFilterType.UserRating:
                filteredItems = TitleCollectionManager.GetAllUserRatings(existingFilters);
                break;

            case TitleFilterType.DateAdded:
                filteredItems = TitleCollectionManager.GetAllDateAdded(existingFilters);
                break;

            default:
                throw new ArgumentException("Unknown filter type");
            }

            if (filteredItems != null)
            {
                foreach (FilteredCollection item in filteredItems)
                {
                    GalleryItem galleryItem = new GalleryItem(_gallery, item.Name, item.Name, this, item.Count);
                    if (!string.IsNullOrEmpty(item.ImagePath))
                    {
                        //TODO:ASYNC this
                        galleryItem.MenuCoverArt = MovieItem.LoadImage(item.ImagePath);
                    }

                    items.Add(galleryItem);
                }
            }

            return(items);
        }