本文整理汇总了C#中IHasMetadata.GetProviderId方法的典型用法代码示例。如果您正苦于以下问题:C# IHasMetadata.GetProviderId方法的具体用法?C# IHasMetadata.GetProviderId怎么用?C# IHasMetadata.GetProviderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHasMetadata
的用法示例。
在下文中一共展示了IHasMetadata.GetProviderId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: 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"
});
}
示例3: 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));
}
}
示例4: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
{
if (!_config.Configuration.EnableFanArtUpdates)
{
return false;
}
var tvdbId = item.GetProviderId(MetadataProviders.Tvdb);
if (!String.IsNullOrEmpty(tvdbId))
{
// Process images
var imagesXmlPath = GetFanartXmlPath(tvdbId);
var fileInfo = new FileInfo(imagesXmlPath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
}
return false;
}
示例5: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
{
var options = FanartSeriesProvider.Current.GetFanartOptions();
if (!options.EnableAutomaticUpdates)
{
return false;
}
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
if (!String.IsNullOrEmpty(id))
{
// Process images
var artistJsonPath = GetArtistJsonPath(_config.CommonApplicationPaths, id);
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
}
return false;
}
示例6: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var options = GetFanartOptions();
if (!options.EnableAutomaticUpdates)
{
return false;
}
var tvdbId = item.GetProviderId(MetadataProviders.Tvdb);
if (!String.IsNullOrEmpty(tvdbId))
{
// Process images
var imagesFilePath = GetFanartJsonPath(tvdbId);
var fileInfo = _fileSystem.GetFileInfo(imagesFilePath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
}
return false;
}
示例7: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
{
if (!_config.Configuration.EnableFanArtUpdates)
{
return false;
}
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
if (!String.IsNullOrEmpty(id))
{
// Process images
var artistXmlPath = GetArtistXmlPath(_config.CommonApplicationPaths, id);
var fileInfo = new FileInfo(artistXmlPath);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
}
return false;
}
示例8: 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 series = (Series)item;
var builder = new StringBuilder();
builder.Append("<Series>");
var tvdb = item.GetProviderId(MetadataProviders.Tvdb);
if (!string.IsNullOrEmpty(tvdb))
{
builder.Append("<id>" + SecurityElement.Escape(tvdb) + "</id>");
}
if (series.Status.HasValue)
{
builder.Append("<Status>" + SecurityElement.Escape(series.Status.Value.ToString()) + "</Status>");
}
if (series.Studios.Count > 0)
{
builder.Append("<Network>" + SecurityElement.Escape(series.Studios[0]) + "</Network>");
}
if (!string.IsNullOrEmpty(series.AirTime))
{
builder.Append("<Airs_Time>" + SecurityElement.Escape(series.AirTime) + "</Airs_Time>");
}
if (series.AirDays != null)
{
if (series.AirDays.Count == 7)
{
builder.Append("<Airs_DayOfWeek>" + SecurityElement.Escape("Daily") + "</Airs_DayOfWeek>");
}
else if (series.AirDays.Count > 0)
{
builder.Append("<Airs_DayOfWeek>" + SecurityElement.Escape(series.AirDays[0].ToString()) + "</Airs_DayOfWeek>");
}
}
if (series.PremiereDate.HasValue)
{
builder.Append("<FirstAired>" + SecurityElement.Escape(series.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + "</FirstAired>");
}
if (series.AnimeSeriesIndex.HasValue)
{
builder.Append("<AnimeSeriesIndex>" + SecurityElement.Escape(series.AnimeSeriesIndex.Value.ToString(UsCulture)) + "</AnimeSeriesIndex>");
}
XmlSaverHelpers.AddCommonNodes(series, _libraryManager, builder);
builder.Append("</Series>");
var xmlFilePath = GetSavePath(item);
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
{
"id",
"Status",
"Network",
"Airs_Time",
"Airs_DayOfWeek",
"FirstAired",
// Don't preserve old series node
"Series",
"SeriesName",
// Deprecated. No longer saving in this field.
"AnimeSeriesIndex"
}, _config, _fileSystem);
}
示例9: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
{
var options = FanartSeriesProvider.Current.GetFanartOptions();
if (!options.EnableAutomaticUpdates)
{
return false;
}
var id = item.GetProviderId(MetadataProviders.Tmdb);
if (string.IsNullOrEmpty(id))
{
id = item.GetProviderId(MetadataProviders.Imdb);
}
if (!string.IsNullOrEmpty(id))
{
// Process images
var path = GetFanartJsonPath(id);
var fileInfo = _fileSystem.GetFileInfo(path);
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
}
return false;
}
示例10: HasChanged
public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService)
{
if (!TvdbSeriesProvider.Current.GetTvDbOptions().EnableAutomaticUpdates)
{
return false;
}
var tvdbId = item.GetProviderId(MetadataProviders.Tvdb);
if (!String.IsNullOrEmpty(tvdbId))
{
// Process images
var imagesXmlPath = Path.Combine(TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, tvdbId), "banners.xml");
var fileInfo = new FileInfo(imagesXmlPath);
return fileInfo.Exists && _fileSystem.GetLastWriteTimeUtc(fileInfo) > (status.DateLastMetadataRefresh ?? DateTime.MinValue);
}
return false;
}
示例11: Save
public void Save(IHasMetadata item, CancellationToken cancellationToken)
{
var series = (Series)item;
var builder = new StringBuilder();
builder.Append("<tvshow>");
XmlSaverHelpers.AddCommonNodes(series, builder, _libraryManager, _userManager, _userDataRepo, _fileSystem, _config);
var tvdb = item.GetProviderId(MetadataProviders.Tvdb);
if (!string.IsNullOrEmpty(tvdb))
{
builder.Append("<id>" + SecurityElement.Escape(tvdb) + "</id>");
builder.AppendFormat("<episodeguide><url cache=\"{0}.xml\">http://www.thetvdb.com/api/1D62F2F90030C444/series/{0}/all/{1}.zip</url></episodeguide>",
tvdb,
string.IsNullOrEmpty(_config.Configuration.PreferredMetadataLanguage) ? "en" : _config.Configuration.PreferredMetadataLanguage);
}
var imdb = item.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrEmpty(imdb))
{
builder.Append("<imdb_id>" + SecurityElement.Escape(imdb) + "</imdb_id>");
}
builder.Append("<season>-1</season>");
builder.Append("<episode>-1</episode>");
if (series.Status.HasValue)
{
builder.Append("<status>" + SecurityElement.Escape(series.Status.Value.ToString()) + "</status>");
}
if (series.Studios.Count > 0)
{
builder.Append("<studio>" + SecurityElement.Escape(series.Studios[0]) + "</studio>");
}
if (!string.IsNullOrEmpty(series.AirTime))
{
builder.Append("<airs_time>" + SecurityElement.Escape(series.AirTime) + "</airs_time>");
}
if (series.AirDays.Count == 7)
{
builder.Append("<airs_dayofweek>" + SecurityElement.Escape("Daily") + "</airs_dayofweek>");
}
else if (series.AirDays.Count > 0)
{
builder.Append("<airs_dayofweek>" + SecurityElement.Escape(series.AirDays[0].ToString()) + "</airs_dayofweek>");
}
builder.Append("</tvshow>");
var xmlFilePath = GetSavePath(item);
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
{
"imdb_id",
"season",
"episode",
"status",
"studio",
"airs_time",
"airs_dayofweek",
"episodeguide"
});
}
示例12: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
{
if (!_config.Configuration.EnableTvDbUpdates)
{
return false;
}
var tvdbId = item.GetProviderId(MetadataProviders.Tvdb);
if (!String.IsNullOrEmpty(tvdbId))
{
// Process images
var imagesXmlPath = Path.Combine(TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, tvdbId), "banners.xml");
var fileInfo = new FileInfo(imagesXmlPath);
return fileInfo.Exists && _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
}
return false;
}
示例13: HasChanged
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
{
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
if (string.IsNullOrEmpty(imdbId))
{
return false;
}
if ((DateTime.UtcNow - item.DateLastRefreshed).TotalDays > 14)
{
if (string.IsNullOrEmpty(item.GetProviderId(RottenTomatoesExternalId.KeyName)))
{
return true;
}
if (!_itemRepo.GetCriticReviews(item.Id).Any())
{
return true;
}
}
return false;
}