Added files for anime importing

This commit is contained in:
iceypotato 2023-07-17 10:54:09 -07:00
parent 5184d995ca
commit 7fd74f59ad
4 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.ImportLists.MyAnimeList
{
internal class MalImport : HttpImportListBase<MalListSettings>
{
public override string Name => "MyAnimeList";
public override ImportListType ListType => ImportListType.Other;
public override TimeSpan MinRefreshInterval => throw new NotImplementedException();
// This constructor the first thing that is called when sonarr creates a button
public MalImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
: base(httpClient, importListStatusService, configService, parsingService, logger)
{
}
public override IList<ImportListItemInfo> Fetch()
{
return FetchItems(g => g.GetListItems());
}
public override IParseImportListResponse GetParser()
{
return new MalParser();
}
public override IImportListRequestGenerator GetRequestGenerator()
{
return new MalRequestGenerator();
}
}
}

View File

@ -0,0 +1,30 @@
using FluentValidation;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.ImportLists.MyAnimeList
{
internal class MalSettingsValidator : AbstractValidator<MalListSettings>
{
public MalSettingsValidator()
{
}
}
internal class MalListSettings : IImportListSettings
{
public string BaseUrl { get; set; }
protected AbstractValidator<MalListSettings> Validator => new MalSettingsValidator();
// This constructor is called when we try to add a new list
public MalListSettings()
{
BaseUrl = "";
}
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.ImportLists.MyAnimeList
{
internal class MalParser : IParseImportListResponse
{
public IList<ImportListItemInfo> ParseResponse(ImportListResponse importListResponse)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,14 @@
namespace NzbDrone.Core.ImportLists.MyAnimeList
{
internal class MalRequestGenerator : IImportListRequestGenerator
{
public ImportListPageableRequestChain GetListItems()
{
var pageableReq = new ImportListPageableRequestChain();
/*
* create
*/
return pageableReq;
}
}
}