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


C# IHasMetadata类代码示例

本文整理汇总了C#中IHasMetadata的典型用法代码示例。如果您正苦于以下问题:C# IHasMetadata类的具体用法?C# IHasMetadata怎么用?C# IHasMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Save

        /// <summary>
        /// Saves the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public void Save(IHasMetadata item, CancellationToken cancellationToken)
        {
            var playlist = (Playlist)item;

            var builder = new StringBuilder();

            builder.Append("<Item>");

            if (!string.IsNullOrEmpty(playlist.PlaylistMediaType))
            {
                builder.Append("<PlaylistMediaType>" + SecurityElement.Escape(playlist.PlaylistMediaType) + "</PlaylistMediaType>");
            }

            XmlSaverHelpers.AddCommonNodes(playlist, _libraryManager, builder);

            builder.Append("</Item>");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
            {
                "OwnerUserId",
                "PlaylistMediaType"

            }, _config);
        }
开发者ID:redteamcpu,项目名称:Emby,代码行数:32,代码来源:PlaylistXmlSaver.cs

示例2: WriteCustomElements

        protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
        {
            var imdb = item.GetProviderId(MetadataProviders.Imdb);

            if (!string.IsNullOrEmpty(imdb))
            {
                writer.WriteElementString("id", imdb);
            }

            var musicVideo = item as MusicVideo;

            if (musicVideo != null)
            {
                if (!string.IsNullOrEmpty(musicVideo.Artist))
                {
                    writer.WriteElementString("artist", musicVideo.Artist);
                }
                if (!string.IsNullOrEmpty(musicVideo.Album))
                {
                    writer.WriteElementString("album", musicVideo.Album);
                }
            }

            var movie = item as Movie;

            if (movie != null)
            {
                if (!string.IsNullOrEmpty(movie.TmdbCollectionName))
                {
                    writer.WriteElementString("set", movie.TmdbCollectionName);
                }
            }
        }
开发者ID:Sile626,项目名称:MediaBrowser,代码行数:33,代码来源:MovieNfoSaver.cs

示例3: Save

        /// <summary>
        /// Saves the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public void Save(IHasMetadata item, CancellationToken cancellationToken)
        {
            var builder = new StringBuilder();

            builder.Append("<Item>");

            var game = (Game)item;

            if (game.PlayersSupported.HasValue)
            {
                builder.Append("<Players>" + SecurityElement.Escape(game.PlayersSupported.Value.ToString(UsCulture)) + "</Players>");
            }

            if (!string.IsNullOrEmpty(game.GameSystem))
            {
                builder.Append("<GameSystem>" + SecurityElement.Escape(game.GameSystem) + "</GameSystem>");
            }

            XmlSaverHelpers.AddCommonNodes(game, _libraryManager, builder);

            builder.Append("</Item>");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
                {
                    "Players",
                    "GameSystem",
                    "NesBox",
                    "NesBoxRom"
                }, _config, _fileSystem);
        }
开发者ID:t-andre,项目名称:Emby,代码行数:38,代码来源:GameXmlSaver.cs

示例4: Save

        /// <summary>
        /// Saves the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        public void Save(IHasMetadata item, CancellationToken cancellationToken)
        {
            var video = (Video)item;

            var builder = new StringBuilder();

            builder.Append("<Title>");

            XmlSaverHelpers.AddCommonNodes(video, builder);

            if (video.CommunityRating.HasValue)
            {
                builder.Append("<IMDBrating>" + SecurityElement.Escape(video.CommunityRating.Value.ToString(UsCulture)) + "</IMDBrating>");
            }

            if (!string.IsNullOrEmpty(video.Overview))
            {
                builder.Append("<Description><![CDATA[" + video.Overview + "]]></Description>");
            }

            var musicVideo = item as MusicVideo;

            if (musicVideo != null)
            {
                if (!string.IsNullOrEmpty(musicVideo.Artist))
                {
                    builder.Append("<Artist>" + SecurityElement.Escape(musicVideo.Artist) + "</Artist>");
                }
                if (!string.IsNullOrEmpty(musicVideo.Album))
                {
                    builder.Append("<Album>" + SecurityElement.Escape(musicVideo.Album) + "</Album>");
                }
            }

            var movie = item as Movie;

            if (movie != null)
            {
                if (!string.IsNullOrEmpty(movie.TmdbCollectionName))
                {
                    builder.Append("<TmdbCollectionName>" + SecurityElement.Escape(movie.TmdbCollectionName) + "</TmdbCollectionName>");
                }
            }
            
            XmlSaverHelpers.AddMediaInfo(video, builder, _itemRepository);

            builder.Append("</Title>");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
                {
                    "IMDBrating",
                    "Description",
                    "Artist",
                    "Album",
                    "TmdbCollectionName"
                });
        }
开发者ID:Tensre,项目名称:MediaBrowser,代码行数:65,代码来源:MovieXmlSaver.cs

示例5: WriteCustomElements

        protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
        {
            var season = (Season)item;

            if (season.IndexNumber.HasValue)
            {
                writer.WriteElementString("seasonnumber", season.IndexNumber.Value.ToString(CultureInfo.InvariantCulture));
            }
        }
开发者ID:Ceten,项目名称:MediaBrowser,代码行数:9,代码来源:SeasonNfoSaver.cs

示例6: IsEnabledFor

        public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
        {
            if (!item.SupportsLocalMetadata)
            {
                return false;
            }

            return item is Series && updateType >= ItemUpdateType.ImageUpdate;
        }
开发者ID:Ceten,项目名称:MediaBrowser,代码行数:9,代码来源:SeriesNfoSaver.cs

示例7: IsEnabledFor

        /// <summary>
        /// Determines whether [is enabled for] [the specified item].
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="updateType">Type of the update.</param>
        /// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
        public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
        {
            if (!item.SupportsLocalMetadata)
            {
                return false;
            }

            return item is MusicAlbum && updateType >= ItemUpdateType.MetadataDownload;
        }
开发者ID:bigjohn322,项目名称:MediaBrowser,代码行数:15,代码来源:AlbumXmlSaver.cs

示例8: IsEnabledFor

        public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
        {
            if (!item.SupportsLocalMetadata)
            {
                return false;
            }

            return item is Episode && updateType >= MinimumUpdateType;
        }
开发者ID:ratanparai,项目名称:Emby,代码行数:9,代码来源:EpisodeNfoSaver.cs

示例9: IsEnabledFor

        /// <summary>
        /// Determines whether [is enabled for] [the specified item].
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="updateType">Type of the update.</param>
        /// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
        public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
        {
            if (!item.SupportsLocalMetadata)
            {
                return false;
            }

            return item is Playlist && updateType >= ItemUpdateType.MetadataImport;
        }
开发者ID:redteamcpu,项目名称:Emby,代码行数:15,代码来源:PlaylistXmlSaver.cs

示例10: Save

        public void Save(IHasMetadata item, CancellationToken cancellationToken)
        {
            var video = (Video)item;

            var builder = new StringBuilder();

            var tag = item is MusicVideo ? "musicvideo" : "movie";

            builder.Append("<" + tag + ">");

            XmlSaverHelpers.AddCommonNodes(video, builder, _libraryManager, _userManager, _userDataRepo, _fileSystem, _config);

            var imdb = item.GetProviderId(MetadataProviders.Imdb);

            if (!string.IsNullOrEmpty(imdb))
            {
                builder.Append("<id>" + SecurityElement.Escape(imdb) + "</id>");
            }

            var musicVideo = item as MusicVideo;

            if (musicVideo != null)
            {
                if (!string.IsNullOrEmpty(musicVideo.Artist))
                {
                    builder.Append("<artist>" + SecurityElement.Escape(musicVideo.Artist) + "</artist>");
                }
                if (!string.IsNullOrEmpty(musicVideo.Album))
                {
                    builder.Append("<album>" + SecurityElement.Escape(musicVideo.Album) + "</album>");
                }
            }

            var movie = item as Movie;

            if (movie != null)
            {
                if (!string.IsNullOrEmpty(movie.TmdbCollectionName))
                {
                    builder.Append("<set>" + SecurityElement.Escape(movie.TmdbCollectionName) + "</set>");
                }
            }

            XmlSaverHelpers.AddMediaInfo((Video)item, _itemRepo, builder);

            builder.Append("</" + tag + ">");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
                {
                    "album",
                    "artist",
                    "set"
                });
        }
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:56,代码来源:MovieXmlSaver.cs

示例11: HasChanged

        public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService)
        {
            var liveTvItem = item as LiveTvProgram;

            if (liveTvItem != null)
            {
                return !liveTvItem.HasImage(ImageType.Primary);
            }
            return false;
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:10,代码来源:ProgramImageProvider.cs

示例12: HasChanged

        public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
        {
            var channelItem = item as IChannelItem;

            if (channelItem != null)
            {
                return !channelItem.HasImage(ImageType.Primary) && !string.IsNullOrWhiteSpace(channelItem.OriginalImageUrl);
            }
            return false;
        }
开发者ID:Sile626,项目名称:MediaBrowser,代码行数:10,代码来源:ChannelItemImageProvider.cs

示例13: HasChanged

        public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
        {
            var liveTvItem = item as ILiveTvRecording;

            if (liveTvItem != null)
            {
                return !liveTvItem.HasImage(ImageType.Primary);
            }
            return false;
        }
开发者ID:paul-777,项目名称:Emby,代码行数:10,代码来源:RecordingImageProvider.cs

示例14: WriteCustomElements

        protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
        {
            var episode = (Episode)item;

            if (episode.IndexNumber.HasValue)
            {
                writer.WriteElementString("episode", episode.IndexNumber.Value.ToString(UsCulture));
            }

            if (episode.IndexNumberEnd.HasValue)
            {
                writer.WriteElementString("episodenumberend", episode.IndexNumberEnd.Value.ToString(UsCulture));
            }

            if (episode.ParentIndexNumber.HasValue)
            {
                writer.WriteElementString("season", episode.ParentIndexNumber.Value.ToString(UsCulture));
            }

            if (episode.PremiereDate.HasValue)
            {
                var formatString = ConfigurationManager.GetNfoConfiguration().ReleaseDateFormat;

                writer.WriteElementString("aired", episode.PremiereDate.Value.ToLocalTime().ToString(formatString));
            }

            if (episode.AirsAfterSeasonNumber.HasValue)
            {
                writer.WriteElementString("airsafter_season", episode.AirsAfterSeasonNumber.Value.ToString(UsCulture));
            }
            if (episode.AirsBeforeEpisodeNumber.HasValue)
            {
                writer.WriteElementString("airsbefore_episode", episode.AirsBeforeEpisodeNumber.Value.ToString(UsCulture));
            }
            if (episode.AirsBeforeSeasonNumber.HasValue)
            {
                writer.WriteElementString("airsbefore_season", episode.AirsBeforeSeasonNumber.Value.ToString(UsCulture));
            }

            if (episode.DvdEpisodeNumber.HasValue)
            {
                writer.WriteElementString("DVD_episodenumber", episode.DvdEpisodeNumber.Value.ToString(UsCulture));
            }

            if (episode.DvdSeasonNumber.HasValue)
            {
                writer.WriteElementString("DVD_season", episode.DvdSeasonNumber.Value.ToString(UsCulture));
            }

            if (episode.AbsoluteEpisodeNumber.HasValue)
            {
                writer.WriteElementString("absolute_number", episode.AbsoluteEpisodeNumber.Value.ToString(UsCulture));
            }
        }
开发者ID:ratanparai,项目名称:Emby,代码行数:54,代码来源:EpisodeNfoSaver.cs

示例15: ItemInfo

        public ItemInfo(IHasMetadata item)
        {
            Path = item.Path;
            ContainingFolderPath = item.ContainingFolderPath;
            IsInMixedFolder = item.IsInMixedFolder;

            var video = item as Video;
            if (video != null)
            {
                VideoType = video.VideoType;
            }
        }
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:12,代码来源:ItemInfo.cs


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