Exemplo n.º 1
0
        private QueryResult <BaseItem> GetTvView(Folder parent, User user, InternalItemsQuery query)
        {
            if (query.Recursive)
            {
                query.Recursive = true;
                query.SetUser(user);

                if (query.IncludeItemTypes.Length == 0)
                {
                    query.IncludeItemTypes = new[] { typeof(Series).Name, typeof(Season).Name, typeof(Episode).Name };
                }

                return(parent.QueryRecursive(query));
            }

            var list = new List <BaseItem>();

            list.Add(GetUserView(SpecialFolder.TvResume, "HeaderContinueWatching", "0", parent));
            list.Add(GetUserView(SpecialFolder.TvNextUp, "HeaderNextUp", "1", parent));
            list.Add(GetUserView(SpecialFolder.TvLatest, "Latest", "2", parent));
            list.Add(GetUserView(SpecialFolder.TvShowSeries, "Shows", "3", parent));
            list.Add(GetUserView(SpecialFolder.TvFavoriteSeries, "HeaderFavoriteShows", "4", parent));
            list.Add(GetUserView(SpecialFolder.TvFavoriteEpisodes, "HeaderFavoriteEpisodes", "5", parent));
            list.Add(GetUserView(SpecialFolder.TvGenres, "Genres", "6", parent));

            return(GetResult(list, parent, query));
        }
Exemplo n.º 2
0
        private QueryResult <BaseItem> GetTvGenres(Folder parent, User user, InternalItemsQuery query)
        {
            var genres = parent.QueryRecursive(new InternalItemsQuery(user)
            {
                IncludeItemTypes       = new[] { typeof(Series).Name },
                Recursive              = true,
                EnableTotalRecordCount = false
            }).Items
                         .SelectMany(i => i.Genres)
                         .DistinctNames()
                         .Select(i =>
            {
                try
                {
                    return(_libraryManager.GetGenre(i));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Error getting genre");
                    return(null);
                }
            })
                         .Where(i => i != null)
                         .Select(i => GetUserViewWithName(i.Name, SpecialFolder.TvGenre, i.SortName, parent));

            return(GetResult(genres, parent, query));
        }
Exemplo n.º 3
0
        private QueryResult <BaseItem> GetMovieFolders(Folder parent, User user, InternalItemsQuery query)
        {
            if (query.Recursive)
            {
                query.Recursive = true;
                query.SetUser(user);

                if (query.IncludeItemTypes.Length == 0)
                {
                    query.IncludeItemTypes = new[] { typeof(Movie).Name };
                }

                return(parent.QueryRecursive(query));
            }

            var list = new List <BaseItem>();

            list.Add(GetUserView(SpecialFolder.MovieResume, "HeaderContinueWatching", "0", parent));
            list.Add(GetUserView(SpecialFolder.MovieLatest, "Latest", "1", parent));
            list.Add(GetUserView(SpecialFolder.MovieMovies, "Movies", "2", parent));
            list.Add(GetUserView(SpecialFolder.MovieCollections, "Collections", "3", parent));
            list.Add(GetUserView(SpecialFolder.MovieFavorites, "Favorites", "4", parent));
            list.Add(GetUserView(SpecialFolder.MovieGenres, "Genres", "5", parent));

            return(GetResult(list, parent, query));
        }