jellyfin/MediaBrowser.Providers/TV/SeriesDynamicInfoProvider.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2013-09-30 00:51:21 +00:00
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Logging;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers.TV
{
public class SeriesDynamicInfoProvider : BaseMetadataProvider, IDynamicInfoProvider
{
public SeriesDynamicInfoProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
: base(logManager, configurationManager)
{
}
public override bool Supports(BaseItem item)
{
return item is Series;
}
2013-12-06 20:07:34 +00:00
public override Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
2013-09-30 00:51:21 +00:00
{
var series = (Series)item;
var episodes = series.RecursiveChildren
.OfType<Episode>()
.ToList();
series.DateLastEpisodeAdded = episodes.Select(i => i.DateCreated)
.OrderByDescending(i => i)
.FirstOrDefault();
// Don't save to the db
return FalseTaskResult;
}
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.Last; }
}
}
}