|
|
@ -20,40 +20,33 @@ namespace Lidarr.Api.V1.Parse
|
|
|
|
private ParseResource Parse()
|
|
|
|
private ParseResource Parse()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var title = Request.Query.Title.Value as string;
|
|
|
|
var title = Request.Query.Title.Value as string;
|
|
|
|
var path = Request.Query.Path.Value as string;
|
|
|
|
var parsedAlbumInfo = Parser.ParseAlbumTitle(title);
|
|
|
|
var parsedEpisodeInfo = path.IsNotNullOrWhiteSpace() ? Parser.ParseMusicPath(path) : Parser.ParseMusicTitle(title);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parsedEpisodeInfo == null)
|
|
|
|
if (parsedAlbumInfo == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new ParseResource
|
|
|
|
var remoteAlbum = _parsingService.Map(parsedAlbumInfo);
|
|
|
|
{
|
|
|
|
|
|
|
|
Title = title,
|
|
|
|
|
|
|
|
ParsedAlbumInfo = parsedEpisodeInfo
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var remoteEpisode = null //_parsingService.Map(parsedEpisodeInfo, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (remoteEpisode != null)
|
|
|
|
if (remoteAlbum != null)
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// return new ParseResource
|
|
|
|
return new ParseResource
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// Title = title,
|
|
|
|
Title = title,
|
|
|
|
// ParsedAlbumInfo = remoteEpisode.ParsedEpisodeInfo,
|
|
|
|
ParsedAlbumInfo = remoteAlbum.ParsedAlbumInfo,
|
|
|
|
// Artist = remoteEpisode.Series.ToResource(),
|
|
|
|
Artist = remoteAlbum.Artist.ToResource(),
|
|
|
|
// Albums = remoteEpisode.Episodes.ToResource()
|
|
|
|
Albums = remoteAlbum.Albums.ToResource()
|
|
|
|
// };
|
|
|
|
};
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
//else
|
|
|
|
else
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// return new ParseResource
|
|
|
|
return new ParseResource
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// Title = title,
|
|
|
|
Title = title,
|
|
|
|
// ParsedAlbumInfo = parsedEpisodeInfo
|
|
|
|
ParsedAlbumInfo = parsedAlbumInfo
|
|
|
|
// };
|
|
|
|
};
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|