Added StatsProvider.
Bound AutoConfigureProvider to kernel. Feed Item Parsing will now check for a SceneName match in SceneNameHelper.
This commit is contained in:
parent
76a9a0c6f0
commit
cb992f1b52
|
@ -99,6 +99,7 @@ namespace NzbDrone.Core
|
|||
_kernel.Bind<JobProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<WebTimer>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<AutoConfigureProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToMethod(
|
||||
c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace NzbDrone.Core.Helpers
|
|||
{
|
||||
public static class SceneNameHelper
|
||||
{
|
||||
//Todo: Move this to a publically available location (so updates can be applied without releasing a new version of NzbDrone)
|
||||
//Todo: GoogleDocs? WCF Web Services on NzbDrone.com?
|
||||
private static readonly List<SceneNameModel> SceneNameMappings = new List<SceneNameModel>
|
||||
{
|
||||
new SceneNameModel
|
||||
|
@ -147,11 +149,6 @@ namespace NzbDrone.Core.Helpers
|
|||
SeriesId = 83714,
|
||||
Name = "Genius with Dave Gorman"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 168161,
|
||||
Name = "Law and Order Los Angeles"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 168161,
|
||||
|
|
|
@ -177,6 +177,7 @@
|
|||
<Compile Include="Providers\Jobs\IJob.cs" />
|
||||
<Compile Include="Providers\Jobs\RssSyncJob.cs" />
|
||||
<Compile Include="Providers\Jobs\UpdateInfoJob.cs" />
|
||||
<Compile Include="Providers\StatsProvider.cs" />
|
||||
<Compile Include="Repository\JobSetting.cs" />
|
||||
<Compile Include="Repository\IndexerSetting.cs" />
|
||||
<Compile Include="Model\EpisodeParseResult.cs" />
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Net;
|
||||
using System.ServiceModel.Syndication;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
@ -147,17 +148,17 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||
return;
|
||||
}
|
||||
|
||||
//var sabTitle = _sabProvider.GetSabTitle(parseResult);
|
||||
var sabTitle = _sabProvider.GetSabTitle(parseResult);
|
||||
|
||||
//if (_sabProvider.IsInQueue(sabTitle))
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (_sabProvider.IsInQueue(sabTitle))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//if (!_sabProvider.AddByUrl(NzbDownloadUrl(feedItem), sabTitle))
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (!_sabProvider.AddByUrl(NzbDownloadUrl(feedItem), sabTitle))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var episode in episodes)
|
||||
{
|
||||
|
@ -185,6 +186,14 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||
|
||||
var seriesInfo = _seriesProvider.FindSeries(episodeParseResult.CleanTitle);
|
||||
|
||||
if (seriesInfo == null)
|
||||
{
|
||||
var seriesId = SceneNameHelper.FindByName(episodeParseResult.CleanTitle);
|
||||
|
||||
if (seriesId != 0)
|
||||
seriesInfo = _seriesProvider.GetSeries(seriesId);
|
||||
}
|
||||
|
||||
if (seriesInfo != null)
|
||||
{
|
||||
episodeParseResult.SeriesId = seriesInfo.SeriesId;
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
{
|
||||
public class StatsProvider
|
||||
{
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
|
||||
public StatsProvider(SeriesProvider seriesProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
}
|
||||
|
||||
public virtual int SeriesCount()
|
||||
{
|
||||
return _seriesProvider.GetAllSeries().Count();
|
||||
}
|
||||
|
||||
public virtual int ActiveSeriesCount()
|
||||
{
|
||||
return _seriesProvider.GetAllSeries().Where(s => s.Status == "Continuing").Count();
|
||||
}
|
||||
|
||||
public virtual int EndedSeriesCount()
|
||||
{
|
||||
return _seriesProvider.GetAllSeries().Where(s => s.Status == "Ended").Count();
|
||||
}
|
||||
|
||||
public virtual int TotalEpisodesCount()
|
||||
{
|
||||
var count = 0;
|
||||
var series = _seriesProvider.GetAllSeries();
|
||||
foreach (var s in series)
|
||||
{
|
||||
count += s.Episodes.Count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public virtual int TotalAiredEpisodesCount()
|
||||
{
|
||||
var count = 0;
|
||||
var series = _seriesProvider.GetAllSeries();
|
||||
foreach (var s in series)
|
||||
{
|
||||
count += s.Episodes.Where(e => e.AirDate.Date <= DateTime.Today).Count();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public virtual int TotalUnairedEpisodesCount()
|
||||
{
|
||||
var count = 0;
|
||||
var series = _seriesProvider.GetAllSeries();
|
||||
foreach (var s in series)
|
||||
{
|
||||
count += s.Episodes.Where(e => e.AirDate.Date > DateTime.Today).Count();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public virtual int TotalEpisodesOnDisk()
|
||||
{
|
||||
var count = 0;
|
||||
var series = _seriesProvider.GetAllSeries();
|
||||
foreach (var s in series)
|
||||
{
|
||||
count += s.Episodes.Where(e => e.EpisodeFileId != 0).Count();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue