New: Lidarr to Readarr

This commit is contained in:
Qstick
2020-02-29 15:51:29 -05:00
parent 7359c2a9fa
commit 3b7eb01918
565 changed files with 1669 additions and 4272 deletions
+51
View File
@@ -0,0 +1,51 @@
using NzbDrone.Core.Parser;
using Readarr.Api.V1.Albums;
using Readarr.Api.V1.Artist;
using Readarr.Http;
namespace Readarr.Api.V1.Parse
{
public class ParseModule : ReadarrRestModule<ParseResource>
{
private readonly IParsingService _parsingService;
public ParseModule(IParsingService parsingService)
{
_parsingService = parsingService;
GetResourceSingle = Parse;
}
private ParseResource Parse()
{
var title = Request.Query.Title.Value as string;
var parsedAlbumInfo = Parser.ParseAlbumTitle(title);
if (parsedAlbumInfo == null)
{
return null;
}
var remoteAlbum = _parsingService.Map(parsedAlbumInfo);
if (remoteAlbum != null)
{
return new ParseResource
{
Title = title,
ParsedAlbumInfo = remoteAlbum.ParsedAlbumInfo,
Artist = remoteAlbum.Artist.ToResource(),
Albums = remoteAlbum.Albums.ToResource()
};
}
else
{
return new ParseResource
{
Title = title,
ParsedAlbumInfo = parsedAlbumInfo
};
}
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System.Collections.Generic;
using NzbDrone.Core.Parser.Model;
using Readarr.Api.V1.Albums;
using Readarr.Api.V1.Artist;
using Readarr.Http.REST;
namespace Readarr.Api.V1.Parse
{
public class ParseResource : RestResource
{
public string Title { get; set; }
public ParsedAlbumInfo ParsedAlbumInfo { get; set; }
public ArtistResource Artist { get; set; }
public List<AlbumResource> Albums { get; set; }
}
}