Esempio n. 1
0
        public object Get(GetMetadataEditorInfo request)
        {
            var item = _libraryManager.GetItemById(request.ItemId);

            var info = new MetadataEditorInfo
            {
                ParentalRatingOptions = _localizationManager.GetParentalRatings(),
                ExternalIdInfos       = _providerManager.GetExternalIdInfos(item).ToArray(),
                Countries             = _localizationManager.GetCountries(),
                Cultures = _localizationManager.GetCultures()
            };

            if (!item.IsVirtualItem && !(item is ICollectionFolder) && !(item is UserView) && !(item is AggregateFolder) && !(item is LiveTvChannel) && !(item is IItemByName) &&
                item.SourceType == SourceType.Library)
            {
                var inheritedContentType  = _libraryManager.GetInheritedContentType(item);
                var configuredContentType = _libraryManager.GetConfiguredContentType(item);

                if (string.IsNullOrWhiteSpace(inheritedContentType) || !string.IsNullOrWhiteSpace(configuredContentType))
                {
                    info.ContentTypeOptions = GetContentTypeOptions(true).ToArray();
                    info.ContentType        = configuredContentType;

                    if (string.IsNullOrWhiteSpace(inheritedContentType) || string.Equals(inheritedContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
                    {
                        info.ContentTypeOptions = info.ContentTypeOptions
                                                  .Where(i => string.IsNullOrWhiteSpace(i.Value) || string.Equals(i.Value, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
                                                  .ToArray();
                    }
                }
            }

            return(ToOptimizedResult(info));
        }
Esempio n. 2
0
        public ActionResult <MetadataEditorInfo> GetMetadataEditorInfo([FromRoute, Required] Guid itemId)
        {
            var item = _libraryManager.GetItemById(itemId);

            var info = new MetadataEditorInfo
            {
                ParentalRatingOptions = _localizationManager.GetParentalRatings().ToArray(),
                ExternalIdInfos       = _providerManager.GetExternalIdInfos(item).ToArray(),
                Countries             = _localizationManager.GetCountries().ToArray(),
                Cultures = _localizationManager.GetCultures().ToArray()
            };

            if (!item.IsVirtualItem &&
                item is not ICollectionFolder &&
                item is not UserView &&
                item is not AggregateFolder &&
                item is not LiveTvChannel &&
                item is not IItemByName &&
                item.SourceType == SourceType.Library)
            {
                var inheritedContentType  = _libraryManager.GetInheritedContentType(item);
                var configuredContentType = _libraryManager.GetConfiguredContentType(item);

                if (string.IsNullOrWhiteSpace(inheritedContentType) ||
                    !string.IsNullOrWhiteSpace(configuredContentType))
                {
                    info.ContentTypeOptions = GetContentTypeOptions(true).ToArray();
                    info.ContentType        = configuredContentType;

                    if (string.IsNullOrWhiteSpace(inheritedContentType) ||
                        string.Equals(inheritedContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
                    {
                        info.ContentTypeOptions = info.ContentTypeOptions
                                                  .Where(i => string.IsNullOrWhiteSpace(i.Value) ||
                                                         string.Equals(i.Value, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
                                                  .ToArray();
                    }
                }
            }

            return(info);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetCountries request)
        {
            var result = _localization.GetCountries().ToList();

            return(ToOptimizedResult(result));
        }
 public ActionResult <IEnumerable <CountryInfo> > GetCountries()
 {
     return(Ok(_localization.GetCountries()));
 }
Esempio n. 5
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public async Task <object> Get(GetCountries request)
        {
            var result = await _localization.GetCountries();

            return(ToOptimizedResult(result));
        }