-
-
Notifications
You must be signed in to change notification settings - Fork 960
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
588c8fb
commit b2686e5
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.Collections.Generic; | ||
using NLog; | ||
using NzbDrone.Common.Http; | ||
using NzbDrone.Core.Configuration; | ||
using NzbDrone.Core.Parser; | ||
using NzbDrone.Core.ThingiProvider; | ||
|
||
namespace NzbDrone.Core.ImportLists.Rss.Imdb | ||
{ | ||
public class ImdbRssImport : RssImportBase<ImdbRssImportSettings> | ||
{ | ||
public override string Name => "IMDb RSS"; | ||
public override ImportListType ListType => ImportListType.Advanced; | ||
|
||
public ImdbRssImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger) | ||
: base(httpClient, importListStatusService, configService, parsingService, logger) | ||
{ | ||
} | ||
|
||
public override IEnumerable<ProviderDefinition> DefaultDefinitions | ||
{ | ||
get | ||
{ | ||
yield return new ImportListDefinition | ||
{ | ||
Name = "IMDb RSS List", | ||
Enabled = Enabled, | ||
EnableAuto = true, | ||
ProfileId = 1, | ||
Implementation = GetType().Name, | ||
Settings = new ImdbRssImportSettings { Url = "https://rss.imdb.com/list/YOURLISTID" }, | ||
}; | ||
yield return new ImportListDefinition | ||
{ | ||
Name = "IMDb RSS Watchlist", | ||
Enabled = Enabled, | ||
EnableAuto = true, | ||
ProfileId = 1, | ||
Implementation = GetType().Name, | ||
Settings = new ImdbRssImportSettings { Url = "https://rss.imdb.com/user/IMDBUSERID/watchlist" }, | ||
}; | ||
} | ||
} | ||
|
||
public override IParseImportListResponse GetParser() | ||
{ | ||
return new ImdbRssImportParser(_logger); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/NzbDrone.Core/ImportLists/Rss/Imdb/ImdbRssImportParser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Xml.Linq; | ||
using NLog; | ||
using NzbDrone.Core.ImportLists.ImportListMovies; | ||
|
||
namespace NzbDrone.Core.ImportLists.Rss.Imdb | ||
{ | ||
public class ImdbRssImportParser : RssImportBaseParser | ||
{ | ||
public ImdbRssImportParser(Logger logger) | ||
: base(logger) | ||
{ | ||
} | ||
|
||
protected override ImportListMovie ProcessItem(XElement item) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/NzbDrone.Core/ImportLists/Rss/Imdb/ImdbRssImportSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using FluentValidation; | ||
using NzbDrone.Core.Annotations; | ||
using NzbDrone.Core.Validation; | ||
|
||
namespace NzbDrone.Core.ImportLists.Rss.Imdb | ||
{ | ||
public class ImdbRssImportSettingsValidator : AbstractValidator<ImdbRssImportSettings> | ||
{ | ||
public ImdbRssImportSettingsValidator() | ||
{ | ||
RuleFor(c => c.Url).NotEmpty(); | ||
} | ||
} | ||
|
||
public class ImdbRssImportSettings : RssImportBaseSettings | ||
{ | ||
private ImdbRssImportSettingsValidator Validator => new (); | ||
|
||
[FieldDefinition(0, Label = "Url", Type = FieldType.Textbox)] | ||
public override string Url { get; set; } | ||
|
||
public override NzbDroneValidationResult Validate() | ||
{ | ||
return new NzbDroneValidationResult(Validator.Validate(this)); | ||
} | ||
} | ||
} |