From 0926862609dd250332f8b5034805911a4490b3c4 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 9 Mar 2019 21:19:10 -0500 Subject: [PATCH] Fixed: Parse endpoint not correctly parsing releases --- src/Lidarr.Api.V1/Parse/ParseModule.cs | 49 ++++++++++-------------- src/Lidarr.Api.V1/Parse/ParseResource.cs | 2 +- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/Lidarr.Api.V1/Parse/ParseModule.cs b/src/Lidarr.Api.V1/Parse/ParseModule.cs index d8b1b1037..c3afb268d 100644 --- a/src/Lidarr.Api.V1/Parse/ParseModule.cs +++ b/src/Lidarr.Api.V1/Parse/ParseModule.cs @@ -20,40 +20,33 @@ namespace Lidarr.Api.V1.Parse private ParseResource Parse() { var title = Request.Query.Title.Value as string; - var path = Request.Query.Path.Value as string; - var parsedEpisodeInfo = path.IsNotNullOrWhiteSpace() ? Parser.ParseMusicPath(path) : Parser.ParseMusicTitle(title); + var parsedAlbumInfo = Parser.ParseAlbumTitle(title); - if (parsedEpisodeInfo == null) + if (parsedAlbumInfo == null) { return null; } - return new ParseResource - { - Title = title, - ParsedAlbumInfo = parsedEpisodeInfo - }; - - //var remoteEpisode = null //_parsingService.Map(parsedEpisodeInfo, 0, 0); + var remoteAlbum = _parsingService.Map(parsedAlbumInfo); - //if (remoteEpisode != null) - //{ - // return new ParseResource - // { - // Title = title, - // ParsedAlbumInfo = remoteEpisode.ParsedEpisodeInfo, - // Artist = remoteEpisode.Series.ToResource(), - // Albums = remoteEpisode.Episodes.ToResource() - // }; - //} - //else - //{ - // return new ParseResource - // { - // Title = title, - // ParsedAlbumInfo = parsedEpisodeInfo - // }; - //} + 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 + }; + } } } } diff --git a/src/Lidarr.Api.V1/Parse/ParseResource.cs b/src/Lidarr.Api.V1/Parse/ParseResource.cs index 38a1668e8..785777a56 100644 --- a/src/Lidarr.Api.V1/Parse/ParseResource.cs +++ b/src/Lidarr.Api.V1/Parse/ParseResource.cs @@ -9,7 +9,7 @@ namespace Lidarr.Api.V1.Parse public class ParseResource : RestResource { public string Title { get; set; } - public ParsedTrackInfo ParsedAlbumInfo { get; set; } + public ParsedAlbumInfo ParsedAlbumInfo { get; set; } public ArtistResource Artist { get; set; } public List Albums { get; set; } }