Esempio n. 1
0
        public static DtoOptions GetDtoOptions(this IHasDtoOptions request)
        {
            var options = new DtoOptions();

            options.Fields = request.GetItemFields().ToList();
            options.EnableImages = request.EnableImages ?? true;

            if (request.ImageTypeLimit.HasValue)
            {
                options.ImageTypeLimit = request.ImageTypeLimit.Value;
            }

            if (!string.IsNullOrWhiteSpace(request.EnableImageTypes))
            {
                options.ImageTypes = (request.EnableImageTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(v => (ImageType)Enum.Parse(typeof(ImageType), v, true)).ToList();
            }

            return options;
        }
Esempio n. 2
0
        public InternalItemsQuery()
        {
            GroupByPresentationUniqueKey = true;
            EnableTotalRecordCount = true;

            DtoOptions = new DtoOptions();
            AlbumNames = new string[] { };
            ArtistNames = new string[] { };
            ExcludeArtistIds = new string[] { };
            ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            BlockUnratedItems = new UnratedItem[] { };
            Tags = new string[] { };
            OfficialRatings = new string[] { };
            SortBy = new string[] { };
            MediaTypes = new string[] { };
            Keywords = new string[] { };
            IncludeItemTypes = new string[] { };
            ExcludeItemTypes = new string[] { };
            Genres = new string[] { };
            Studios = new string[] { };
            StudioIds = new string[] { };
            GenreIds = new string[] { };
            ImageTypes = new ImageType[] { };
            VideoTypes = new VideoType[] { };
            Years = new int[] { };
            PersonTypes = new string[] { };
            PersonIds = new string[] { };
            ChannelIds = new string[] { };
            ItemIds = new string[] { };
            ExcludeItemIds = new string[] { };
            AncestorIds = new string[] { };
            TopParentIds = new string[] { };
            ExcludeTags = new string[] { };
            ExcludeInheritedTags = new string[] { };
            LocationTypes = new LocationType[] { };
            ExcludeLocationTypes = new LocationType[] { };
            PresetViews = new string[] { };
            SourceTypes = new SourceType[] { };
            ExcludeSourceTypes = new SourceType[] { };
            TrailerTypes = new TrailerType[] { };
            AirDays = new DayOfWeek[] { };
            SeriesStatuses = new SeriesStatus[] { };
            OrderBy = new List<Tuple<string, SortOrder>>();
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the channel info dto.
        /// </summary>
        /// <param name="info">The info.</param>
        /// <param name="options">The options.</param>
        /// <param name="currentProgram">The current program.</param>
        /// <param name="user">The user.</param>
        /// <returns>ChannelInfoDto.</returns>
        public ChannelInfoDto GetChannelInfoDto(LiveTvChannel info, DtoOptions options, LiveTvProgram currentProgram, User user = null)
        {
            var dto = new ChannelInfoDto
            {
                Name = info.Name,
                ServiceName = info.ServiceName,
                ChannelType = info.ChannelType,
                Number = info.Number,
                Type = info.GetClientTypeName(),
                Id = info.Id.ToString("N"),
                MediaType = info.MediaType,
                ExternalId = info.ExternalId,
                MediaSources = info.GetMediaSources(true).ToList(),
                ServerId = _appHost.SystemId
            };

            if (user != null)
            {
                dto.UserData = _userDataManager.GetUserDataDto(info, user);

                dto.PlayAccess = info.GetPlayAccess(user);
            }

            var imageTag = GetImageTag(info);

            if (imageTag != null)
            {
                dto.ImageTags[ImageType.Primary] = imageTag;

                _dtoService.AttachPrimaryImageAspectRatio(dto, info, new List<ItemFields>
                    {
                        ItemFields.PrimaryImageAspectRatio
                    });
            }

            if (currentProgram != null)
            {
                dto.CurrentProgram = _dtoService.GetBaseItemDto(currentProgram, options, user);
            }

            return dto;
        }