You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
7 years ago
|
using System.Collections.Generic;
|
||
|
using NzbDrone.Core.MediaFiles;
|
||
|
using Lidarr.Http;
|
||
|
using Lidarr.Http.REST;
|
||
|
|
||
7 years ago
|
namespace Lidarr.Api.V1.Tracks
|
||
7 years ago
|
{
|
||
|
public class RenameTrackModule : LidarrRestModule<RenameTrackResource>
|
||
|
{
|
||
|
private readonly IRenameTrackFileService _renameTrackFileService;
|
||
|
|
||
|
public RenameTrackModule(IRenameTrackFileService renameTrackFileService)
|
||
|
: base("rename")
|
||
|
{
|
||
|
_renameTrackFileService = renameTrackFileService;
|
||
|
|
||
|
GetResourceAll = GetTracks;
|
||
|
}
|
||
|
|
||
|
private List<RenameTrackResource> GetTracks()
|
||
|
{
|
||
|
int artistId;
|
||
|
|
||
7 years ago
|
if (Request.Query.ArtistId.HasValue)
|
||
7 years ago
|
{
|
||
7 years ago
|
artistId = (int)Request.Query.ArtistId;
|
||
7 years ago
|
}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
throw new BadRequestException("artistId is missing");
|
||
|
}
|
||
|
|
||
|
if (Request.Query.albumId.HasValue)
|
||
|
{
|
||
|
var albumId = (int)Request.Query.albumId;
|
||
|
return _renameTrackFileService.GetRenamePreviews(artistId, albumId).ToResource();
|
||
|
}
|
||
|
|
||
|
return _renameTrackFileService.GetRenamePreviews(artistId).ToResource();
|
||
|
}
|
||
|
}
|
||
|
}
|