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; } }