sonarr-repo-only/NzbDrone.Core/Providers/Metadata/MetadataBase.cs

69 lines
2.6 KiB
C#
Raw Normal View History

2012-07-07 23:52:04 +00:00
using System;
using NLog;
2012-07-10 04:37:24 +00:00
using NzbDrone.Common;
2013-02-24 06:48:52 +00:00
using NzbDrone.Core.Configuration;
2013-03-01 07:03:41 +00:00
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
2012-07-07 23:52:04 +00:00
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
using TvdbLib.Data;
2012-07-07 23:52:04 +00:00
namespace NzbDrone.Core.Providers.Metadata
{
public abstract class MetadataBase
{
protected readonly Logger _logger;
2013-02-24 06:48:52 +00:00
protected readonly IConfigService _configService;
2012-07-10 04:37:24 +00:00
protected readonly DiskProvider _diskProvider;
protected readonly BannerProvider _bannerProvider;
protected readonly IEpisodeService _episodeService;
2012-07-07 23:52:04 +00:00
2013-02-24 06:48:52 +00:00
protected MetadataBase(IConfigService configService, DiskProvider diskProvider,
BannerProvider bannerProvider, IEpisodeService episodeService)
2012-07-07 23:52:04 +00:00
{
2013-02-24 06:48:52 +00:00
_configService = configService;
2012-07-10 04:37:24 +00:00
_diskProvider = diskProvider;
_bannerProvider = bannerProvider;
_episodeService = episodeService;
2012-07-07 23:52:04 +00:00
_logger = LogManager.GetLogger(GetType().ToString());
}
/// <summary>
2012-07-10 04:37:24 +00:00
/// Gets the name for the metabase provider
2012-07-07 23:52:04 +00:00
/// </summary>
public abstract string Name { get; }
/// <summary>
2012-07-10 04:37:24 +00:00
/// Creates metadata for a series
2012-07-07 23:52:04 +00:00
/// </summary>
2012-07-10 04:37:24 +00:00
/// <param name = "series">The series to create the metadata for</param>
/// <param name = "tvDbSeries">Series information from TheTvDb</param>
public abstract void CreateForSeries(Series series, TvdbSeries tvDbSeries);
2012-07-07 23:52:04 +00:00
/// <summary>
2012-07-10 04:37:24 +00:00
/// Creates metadata for the episode file
2012-07-07 23:52:04 +00:00
/// </summary>
2012-07-10 04:37:24 +00:00
/// <param name = "episodeFile">The episode file to create the metadata</param>
/// <param name = "tvDbSeries">Series information from TheTvDb</param>
public abstract void CreateForEpisodeFile(EpisodeFile episodeFile, TvdbSeries tvDbSeries);
/// <summary>
/// Removes metadata for a series
/// </summary>
/// <param name = "series">The series to create the metadata for</param>
public abstract void RemoveForSeries(Series series);
/// <summary>
/// Removes metadata for the episode file
/// </summary>
/// <param name = "episodeFile">The episode file to create the metadata</param>
public abstract void RemoveForEpisodeFile(EpisodeFile episodeFile);
2012-07-07 23:52:04 +00:00
2012-07-10 04:37:24 +00:00
public virtual string GetEpisodeGuideUrl(int seriesId)
{
return String.Format("http://www.thetvdb.com/api/{0}/series/{1}/all/en.zip", TvDbProvider.TVDB_APIKEY, seriesId);
}
2012-07-07 23:52:04 +00:00
}
}