Added nzbs.org using the provider model.

pull/7/merge
kay.one 14 years ago
parent 375a0c333e
commit 16234d6b79

@ -129,7 +129,7 @@
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PublicFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AA_BB" ElementKind="Constants" />

@ -173,8 +173,9 @@
<Compile Include="Model\SceneNameModel.cs" />
<Compile Include="Model\SeasonParseResult.cs" />
<Compile Include="Model\UpcomingEpisodesModel.cs" />
<Compile Include="Providers\FeedProviderBase.cs" />
<Compile Include="Providers\Feed\FeedProviderBase.cs" />
<Compile Include="Providers\ExternalNotificationProvider.cs" />
<Compile Include="Providers\Feed\NzbsOrgFeedProvider.cs" />
<Compile Include="Providers\HistoryProvider.cs" />
<Compile Include="Providers\IBacklogProvider.cs" />
<Compile Include="Providers\IExtenalNotificationProvider.cs" />
@ -275,7 +276,6 @@
<Content Include="Libraries\System.Data.SQLite.XML" />
<Content Include="Libraries\TvdbLib.dll" />
<Content Include="Libraries\TvdbLib.XML" />
<Content Include="Libraries\UPnP.dll" />
</ItemGroup>
<ItemGroup>
<None Include="Libraries\nlog.xsd">

@ -2,21 +2,24 @@
using System.Xml;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers
namespace NzbDrone.Core.Providers.Feed
{
abstract class FeedProviderBase
{
private readonly ISeriesProvider _seriesProvider;
private readonly ISeasonProvider _seasonProvider;
private readonly IEpisodeProvider _episodeProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
protected readonly ISeriesProvider _seriesProvider;
protected readonly ISeasonProvider _seasonProvider;
protected readonly IEpisodeProvider _episodeProvider;
protected readonly IConfigProvider _configProvider;
protected static readonly Logger Logger = LogManager.GetCurrentClassLogger();
protected FeedProviderBase(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider)
protected FeedProviderBase(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider)
{
_seriesProvider = seriesProvider;
_seasonProvider = seasonProvider;
_episodeProvider = episodeProvider;
_configProvider = configProvider;
}
@ -72,6 +75,7 @@ namespace NzbDrone.Core.Providers
foreach (var url in URL)
{
Logger.Debug("Downloading RSS " + url);
var feed = SyndicationFeed.Load(XmlReader.Create(url)).Items;
foreach (var item in feed)
@ -85,6 +89,8 @@ namespace NzbDrone.Core.Providers
private void ProcessItem(SyndicationItem feedItem)
{
Logger.Info("Processing RSS feed item " + feedItem.Title);
var parseResult = ParseFeed(feedItem);
if (!_seriesProvider.IsMonitored(parseResult.SeriesId))
@ -106,8 +112,6 @@ namespace NzbDrone.Core.Providers
{
Logger.Debug("Episode {0} is not needed. skipping.", parseResult);
}
}
}

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Text;
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers.Feed
{
class NzbsOrgFeedProvider : FeedProviderBase
{
public NzbsOrgFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider)
{
}
protected override string[] URL
{
get
{
return new[] { string.Format("http://nzbs.org/rss.php?type=1&i={0}&h={1}", _configProvider.NzbsOrgUId, _configProvider.NzbsOrgHash) };
}
}
protected override string Name
{
get { return "Nzbs.Org"; }
}
protected override string NzbDownloadUrl(SyndicationItem item)
{
return item.Id.Replace("action=view", "action=getnzb");
}
}
}

@ -12,16 +12,14 @@ namespace NzbDrone.Core.Providers
public class PostProcessingProvider : IPostProcessingProvider
{
private readonly ISeriesProvider _seriesProvider;
private readonly IConfigProvider _configProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly IRenameProvider _renameProvider;
public PostProcessingProvider(ISeriesProvider seriesProvider, IConfigProvider configProvider,
public PostProcessingProvider(ISeriesProvider seriesProvider,
IMediaFileProvider mediaFileProvider, IRenameProvider renameProvider)
{
_seriesProvider = seriesProvider;
_configProvider = configProvider;
_mediaFileProvider = mediaFileProvider;
_mediaFileProvider = mediaFileProvider;
_renameProvider = renameProvider;
}

Loading…
Cancel
Save