예제 #1
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public object Get(GetDisplayPreferences request)
        {
            Guid displayPreferencesId;

            if (!Guid.TryParse(request.Id, out displayPreferencesId))
            {
                displayPreferencesId = request.Id.GetMD5();
            }

            var result = _displayPreferencesManager.GetDisplayPreferences(displayPreferencesId, request.UserId, request.Client);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
예제 #2
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public object Get(GetDisplayPreferences request)
        {
            var displayPreferences = _displayPreferencesManager.GetDisplayPreferences(Guid.Parse(request.UserId), request.Client);
            var itemPreferences    = _displayPreferencesManager.GetItemDisplayPreferences(displayPreferences.UserId, Guid.Empty, displayPreferences.Client);

            var dto = new DisplayPreferencesDto
            {
                Client           = displayPreferences.Client,
                Id               = displayPreferences.UserId.ToString(),
                ViewType         = itemPreferences.ViewType.ToString(),
                SortBy           = itemPreferences.SortBy,
                SortOrder        = itemPreferences.SortOrder,
                IndexBy          = displayPreferences.IndexBy?.ToString(),
                RememberIndexing = itemPreferences.RememberIndexing,
                RememberSorting  = itemPreferences.RememberSorting,
                ScrollDirection  = displayPreferences.ScrollDirection,
                ShowBackdrop     = displayPreferences.ShowBackdrop,
                ShowSidebar      = displayPreferences.ShowSidebar
            };

            foreach (var homeSection in displayPreferences.HomeSections)
            {
                dto.CustomPrefs["homesection" + homeSection.Order] = homeSection.Type.ToString().ToLowerInvariant();
            }

            foreach (var itemDisplayPreferences in _displayPreferencesManager.ListItemDisplayPreferences(displayPreferences.UserId, displayPreferences.Client))
            {
                dto.CustomPrefs["landing-" + itemDisplayPreferences.ItemId] = itemDisplayPreferences.ViewType.ToString().ToLowerInvariant();
            }

            dto.CustomPrefs["chromecastVersion"]          = displayPreferences.ChromecastVersion.ToString().ToLowerInvariant();
            dto.CustomPrefs["skipForwardLength"]          = displayPreferences.SkipForwardLength.ToString();
            dto.CustomPrefs["skipBackLength"]             = displayPreferences.SkipBackwardLength.ToString();
            dto.CustomPrefs["enableNextVideoInfoOverlay"] = displayPreferences.EnableNextVideoInfoOverlay.ToString();
            dto.CustomPrefs["tvhome"] = displayPreferences.TvHome;

            return(ToOptimizedResult(dto));
        }
예제 #3
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public object Get(GetDisplayPreferences request)
        {
            var result = _displayPreferencesManager.GetDisplayPreferences(request.Id, request.UserId, request.Client);

            return(ToOptimizedResult(result));
        }