New: Setting SceneName and ReleaseGroup for TrackFiles via API

Closes #2248

Co-Authored-By: Michael Higgins <mdhiggins23@gmail.com>
pull/3314/head
Qstick 2 years ago
parent 9cce93b25d
commit 032089b1f9

@ -11,6 +11,7 @@ using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Music;
using NzbDrone.Core.Parser;
using NzbDrone.SignalR;
using BadRequestException = Lidarr.Http.REST.BadRequestException;
using HttpStatusCode = System.Net.HttpStatusCode;
@ -111,6 +112,17 @@ namespace Lidarr.Api.V1.TrackFiles
{
var trackFile = _mediaFileService.Get(trackFileResource.Id);
trackFile.Quality = trackFileResource.Quality;
if (trackFileResource.SceneName != null && SceneChecker.IsSceneTitle(trackFileResource.SceneName))
{
trackFile.SceneName = trackFileResource.SceneName;
}
if (trackFileResource.ReleaseGroup != null)
{
trackFile.ReleaseGroup = trackFileResource.ReleaseGroup;
}
_mediaFileService.Update(trackFile);
return Accepted(trackFile.Id);
}
@ -126,6 +138,16 @@ namespace Lidarr.Api.V1.TrackFiles
{
trackFile.Quality = resource.Quality;
}
if (resource.SceneName != null && SceneChecker.IsSceneTitle(resource.SceneName))
{
trackFile.SceneName = resource.SceneName;
}
if (resource.ReleaseGroup != null)
{
trackFile.ReleaseGroup = resource.ReleaseGroup;
}
}
_mediaFileService.Update(trackFiles);

@ -7,5 +7,7 @@ namespace Lidarr.Api.V1.TrackFiles
{
public List<int> TrackFileIds { get; set; }
public QualityModel Quality { get; set; }
public string SceneName { get; set; }
public string ReleaseGroup { get; set; }
}
}

@ -15,6 +15,8 @@ namespace Lidarr.Api.V1.TrackFiles
public string Path { get; set; }
public long Size { get; set; }
public DateTime DateAdded { get; set; }
public string SceneName { get; set; }
public string ReleaseGroup { get; set; }
public QualityModel Quality { get; set; }
public int QualityWeight { get; set; }
public MediaInfoResource MediaInfo { get; set; }
@ -52,6 +54,8 @@ namespace Lidarr.Api.V1.TrackFiles
Path = model.Path,
Size = model.Size,
DateAdded = model.DateAdded,
SceneName = model.SceneName,
ReleaseGroup = model.ReleaseGroup,
Quality = model.Quality,
QualityWeight = QualityWeight(model.Quality),
MediaInfo = model.MediaInfo.ToResource()
@ -74,6 +78,8 @@ namespace Lidarr.Api.V1.TrackFiles
Path = model.Path,
Size = model.Size,
DateAdded = model.DateAdded,
SceneName = model.SceneName,
ReleaseGroup = model.ReleaseGroup,
Quality = model.Quality,
QualityWeight = QualityWeight(model.Quality),
MediaInfo = model.MediaInfo.ToResource(),

Loading…
Cancel
Save