本文整理汇总了C#中IHasMetadata类的典型用法代码示例。如果您正苦于以下问题:C# IHasMetadata类的具体用法?C# IHasMetadata怎么用?C# IHasMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IHasMetadata类属于命名空间,在下文中一共展示了IHasMetadata类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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, _libraryManager, builder);
var musicVideo = item as MusicVideo;
if (musicVideo != null)
{
if (musicVideo.Artists.Count > 0)
{
builder.Append("<Artist>" + SecurityElement.Escape(string.Join(";", musicVideo.Artists.ToArray())) + "</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>
{
// Deprecated. No longer saving in this field.
"IMDBrating",
// Deprecated. No longer saving in this field.
"Description",
"Artist",
"Album",
"TmdbCollectionName"
}, _config, _fileSystem);
}
开发者ID:jvanhie,项目名称:Emby.Plugins,代码行数:59,代码来源:MovieXmlSaver.cs
示例17: WriteCustomElements
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
var series = (Series)item;
var tvdb = item.GetProviderId(MetadataProviders.Tvdb);
if (!string.IsNullOrEmpty(tvdb))
{
writer.WriteElementString("id", tvdb);
writer.WriteStartElement("episodeguide");
var language = item.GetPreferredMetadataLanguage();
language = string.IsNullOrEmpty(language)
? "en"
: language;
writer.WriteStartElement("url");
writer.WriteAttributeString("cache", string.Format("{0}.xml", tvdb));
writer.WriteString(string.Format("http://www.thetvdb.com/api/1D62F2F90030C444/series/{0}/all/{1}.zip", tvdb, language));
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteElementString("season", "-1");
writer.WriteElementString("episode", "-1");
if (series.Status.HasValue)
{
writer.WriteElementString("status", series.Status.Value.ToString());
}
if (!string.IsNullOrEmpty(series.AirTime))
{
writer.WriteElementString("airs_time", series.AirTime);
}
if (series.AirDays.Count == 7)
{
writer.WriteElementString("airs_dayofweek", "Daily");
}
else if (series.AirDays.Count > 0)
{
writer.WriteElementString("airs_dayofweek", series.AirDays[0].ToString());
}
if (series.AnimeSeriesIndex.HasValue)
{
writer.WriteElementString("animeseriesindex", series.AnimeSeriesIndex.Value.ToString(CultureInfo.InvariantCulture));
}
}
开发者ID:Ceten,项目名称:MediaBrowser,代码行数:52,代码来源:SeriesNfoSaver.cs
示例18: GetSavePath
public string GetSavePath(IHasMetadata item)
{
var video = (Video)item;
if (video.VideoType == VideoType.Dvd || video.VideoType == VideoType.BluRay || video.VideoType == VideoType.HdDvd)
{
var path = item.ContainingFolderPath;
return Path.Combine(path, Path.GetFileNameWithoutExtension(path) + ".nfo");
}
return Path.ChangeExtension(item.Path, ".nfo");
}
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:13,代码来源:MovieXmlSaver.cs
示例19: 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>");
XmlSaverHelpers.AddCommonNodes((BoxSet)item, _libraryManager, builder);
builder.Append("</Item>");
var xmlFilePath = GetSavePath(item);
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string> { }, _config, _fileSystem);
}
开发者ID:paul-777,项目名称:Emby,代码行数:20,代码来源:BoxSetXmlSaver.cs
示例20: Save
public void Save(IHasMetadata item, CancellationToken cancellationToken)
{
var builder = new StringBuilder();
builder.Append("<season>");
XmlSaverHelpers.AddCommonNodes((Season)item, builder, _libraryManager, _userManager, _userDataRepo, _fileSystem, _config);
builder.Append("</season>");
var xmlFilePath = GetSavePath(item);
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string> { });
}
开发者ID:WWWesten,项目名称:MediaBrowser.Plugins,代码行数:14,代码来源:SeasonXmlSaver.cs
注:本文中的IHasMetadata类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论