当前位置: 首页>>代码示例>>C#>>正文


C# BaseItemDto.GetProviderId方法代码示例

本文整理汇总了C#中MediaBrowser.Model.Dto.BaseItemDto.GetProviderId方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItemDto.GetProviderId方法的具体用法?C# BaseItemDto.GetProviderId怎么用?C# BaseItemDto.GetProviderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaBrowser.Model.Dto.BaseItemDto的用法示例。


在下文中一共展示了BaseItemDto.GetProviderId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateItem

        private void UpdateItem(BaseItemDto request, BaseItem item)
        {
            if (item.LocationType == LocationType.Offline)
            {
                throw new InvalidOperationException(string.Format("{0} is currently offline.", item.Name));
            }

            item.Name = request.Name;

            // Only set the forced value if they changed it, or there's already one
            if (!string.Equals(item.SortName, request.SortName) || !string.IsNullOrEmpty(item.ForcedSortName))
            {
                item.ForcedSortName = request.SortName;
            }

            item.DisplayMediaType = request.DisplayMediaType;
            item.CommunityRating = request.CommunityRating;
            item.HomePageUrl = request.HomePageUrl;
            item.Budget = request.Budget;
            item.Revenue = request.Revenue;
            item.CriticRating = request.CriticRating;
            item.CriticRatingSummary = request.CriticRatingSummary;
            item.IndexNumber = request.IndexNumber;
            item.ParentIndexNumber = request.ParentIndexNumber;
            item.Overview = request.Overview;
            item.Genres = request.Genres;
            item.Tags = request.Tags;
            item.Studios = request.Studios.Select(x => x.Name).ToList();
            item.People = request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList();

            item.EndDate = request.EndDate != default(DateTime) ? request.EndDate : null;
            item.PremiereDate = request.PremiereDate != default(DateTime) ? request.PremiereDate : null;
            item.ProductionYear = request.ProductionYear;
            item.AspectRatio = request.AspectRatio;
            item.Language = request.Language;
            item.OfficialRating = request.OfficialRating;
            item.CustomRating = request.CustomRating;
            item.DontFetchMeta = !(request.EnableInternetProviders ?? true);
            if (request.EnableInternetProviders ?? true)
            {
                item.LockedFields = request.LockedFields;
            }
            else
            {
                item.LockedFields.Clear();
            }

            foreach (var pair in request.ProviderIds.ToList())
            {
                if (string.IsNullOrEmpty(pair.Value))
                {
                    request.ProviderIds.Remove(pair.Key);
                }
            }

            item.ProviderIds = request.ProviderIds;

            var game = item as Game;

            if (game != null)
            {
                game.PlayersSupported = request.Players;
            }

            var song = item as Audio;

            if (song != null)
            {
                song.Album = request.Album;
                song.AlbumArtist = request.AlbumArtist;
                song.Artist = request.Artists[0];
            }

            var musicAlbum = item as MusicAlbum;

            if (musicAlbum != null)
            {
                musicAlbum.MusicBrainzReleaseGroupId = request.GetProviderId("MusicBrainzReleaseGroupId");
            }

            var musicVideo = item as MusicVideo;

            if (musicVideo != null)
            {
                musicVideo.Artist = request.Artists[0];
                musicVideo.Album = request.Album;
            }

            var series = item as Series;
            if (series != null)
            {
                series.Status = request.Status;
                series.AirDays = request.AirDays;
                series.AirTime = request.AirTime;
            }
        }
开发者ID:squibber46,项目名称:MediaBrowser,代码行数:96,代码来源:ItemUpdateService.cs


注:本文中的MediaBrowser.Model.Dto.BaseItemDto.GetProviderId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。