mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
parent
a602611a5f
commit
a4b78b44ce
1307 changed files with 8702 additions and 7403 deletions
|
@ -1,17 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using HttpStatusCode = System.Net.HttpStatusCode;
|
||||
|
||||
namespace Lidarr.Api.V1.TrackFiles
|
||||
|
@ -48,8 +48,8 @@ namespace Lidarr.Api.V1.TrackFiles
|
|||
UpdateResource = SetQuality;
|
||||
DeleteResource = DeleteTrackFile;
|
||||
|
||||
Put("/editor", trackFiles => SetQuality());
|
||||
Delete("/bulk", trackFiles => DeleteTrackFiles());
|
||||
Put("/editor", trackFiles => SetQuality());
|
||||
Delete("/bulk", trackFiles => DeleteTrackFiles());
|
||||
}
|
||||
|
||||
private TrackFileResource MapToResource(TrackFile trackFile)
|
||||
|
@ -78,7 +78,7 @@ namespace Lidarr.Api.V1.TrackFiles
|
|||
var albumIdQuery = Request.Query.AlbumId;
|
||||
var unmappedQuery = Request.Query.Unmapped;
|
||||
|
||||
if (!artistIdQuery.HasValue && !trackFileIdsQuery.HasValue && !albumIdQuery.HasValue && !unmappedQuery.HasValue)
|
||||
if (!artistIdQuery.HasValue && !trackFileIdsQuery.HasValue && !albumIdQuery.HasValue && !unmappedQuery.HasValue)
|
||||
{
|
||||
throw new Lidarr.Http.REST.BadRequestException("artistId, albumId, trackFileIds or unmapped must be provided");
|
||||
}
|
||||
|
@ -112,10 +112,9 @@ namespace Lidarr.Api.V1.TrackFiles
|
|||
var albumArtist = _artistService.GetArtist(album.ArtistId);
|
||||
result.AddRange(_mediaFileService.GetFilesByAlbum(album.Id).ConvertAll(f => f.ToResource(albumArtist, _upgradableSpecification)));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
string trackFileIdsValue = trackFileIdsQuery.Value.ToString();
|
||||
|
@ -152,8 +151,8 @@ namespace Lidarr.Api.V1.TrackFiles
|
|||
|
||||
_mediaFileService.Update(trackFiles);
|
||||
|
||||
return ResponseWithCode(trackFiles.ConvertAll(f => f.ToResource(trackFiles.First().Artist.Value, _upgradableSpecification))
|
||||
, Nancy.HttpStatusCode.Accepted);
|
||||
return ResponseWithCode(trackFiles.ConvertAll(f => f.ToResource(trackFiles.First().Artist.Value, _upgradableSpecification)),
|
||||
Nancy.HttpStatusCode.Accepted);
|
||||
}
|
||||
|
||||
private void DeleteTrackFile(int id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue