IndexerType added, this will store the source indexer in history, so users can see (if they care) and we can add an icon if we want.

This commit is contained in:
Mark McDowall 2011-04-27 17:11:08 -07:00
parent de003b9774
commit 7e946277bb
8 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Model
{
public enum IndexerType
{
Other = 0,
NzbsOrg = 1,
NzbMatrix = 2,
NzbsRus = 3,
Newzbin = 4
}
}

View File

@ -166,6 +166,7 @@
<Compile Include="Instrumentation\SubsonicTarget.cs" />
<Compile Include="Instrumentation\ExceptioneerTarget.cs" />
<Compile Include="Instrumentation\NlogWriter.cs" />
<Compile Include="Model\IndexerType.cs" />
<Compile Include="Model\SabnzbdInfoModel.cs" />
<Compile Include="Providers\Indexer\SyndicationFeedXmlReader.cs" />
<Compile Include="Providers\AutoConfigureProvider.cs" />

View File

@ -49,7 +49,6 @@ namespace NzbDrone.Core.Providers.Indexer
/// </summary>
protected abstract string[] Urls { get; }
/// <summary>
/// Gets the credential.
/// </summary>
@ -58,7 +57,6 @@ namespace NzbDrone.Core.Providers.Indexer
get { return null; }
}
public IndexerSetting Settings
{
get
@ -189,7 +187,8 @@ namespace NzbDrone.Core.Providers.Indexer
EpisodeId = episode.EpisodeId,
IsProper = parseResult.Proper,
NzbTitle = feedItem.Title.Text,
Quality = parseResult.Quality
Quality = parseResult.Quality,
Indexer = GetIndexerType()
});
}
}
@ -246,6 +245,15 @@ namespace NzbDrone.Core.Providers.Indexer
/// <returns>Download link URL</returns>
protected abstract string NzbDownloadUrl(SyndicationItem item);
/// <summary>
/// Gets he IndexerType Enum for this indexer
/// </summary>
/// <returns>IndexerType Enum</returns>
protected virtual IndexerType GetIndexerType()
{
return IndexerType.Other;
}
private bool InHistory(IList<Episode> episodes, EpisodeParseResult parseResult, SyndicationItem feedItem)
{
foreach (var episode in episodes)

View File

@ -52,5 +52,10 @@ namespace NzbDrone.Core.Providers.Indexer
return currentResult;
}
protected override IndexerType GetIndexerType()
{
return IndexerType.Newzbin;
}
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Net;
using System.ServiceModel.Syndication;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using SubSonic.Repository;
@ -36,5 +37,10 @@ namespace NzbDrone.Core.Providers.Indexer
{
return item.Links[0].Uri.ToString();
}
protected override IndexerType GetIndexerType()
{
return IndexerType.NzbMatrix;
}
}
}

View File

@ -1,5 +1,6 @@
using System.Net;
using System.ServiceModel.Syndication;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using SubSonic.Repository;
@ -33,6 +34,9 @@ namespace NzbDrone.Core.Providers.Indexer
return item.Id;
}
protected override IndexerType GetIndexerType()
{
return IndexerType.NzbsOrg;
}
}
}

View File

@ -1,5 +1,6 @@
using System.Net;
using System.ServiceModel.Syndication;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using SubSonic.Repository;
@ -36,5 +37,10 @@ namespace NzbDrone.Core.Providers.Indexer
{
return item.Links[0].Uri.ToString();
}
protected override IndexerType GetIndexerType()
{
return IndexerType.NzbsRus;
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality;
using SubSonic.SqlGeneration.Schema;
@ -14,6 +15,7 @@ namespace NzbDrone.Core.Repository
public QualityTypes Quality { get; set; }
public DateTime Date { get; set; }
public bool IsProper { get; set; }
public IndexerType? Indexer { get; set; }
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
public virtual Episode Episode { get; protected set; }