New: Setting SceneName and ReleaseGroup for EpisodeFiles via API

This commit is contained in:
Michael Higgins 2021-05-15 17:58:53 -04:00 committed by GitHub
parent ee227e3b1d
commit 82e0a4bd0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -9,5 +9,7 @@ namespace Sonarr.Api.V3.EpisodeFiles
public List<int> EpisodeFileIds { get; set; } public List<int> EpisodeFileIds { get; set; }
public Language Language { get; set; } public Language Language { get; set; }
public QualityModel Quality { get; set; } public QualityModel Quality { get; set; }
public string SceneName { get; set; }
public string ReleaseGroup { get; set; }
} }
} }

View File

@ -9,6 +9,7 @@ using NzbDrone.Core.Exceptions;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.SignalR; using NzbDrone.SignalR;
using Sonarr.Http; using Sonarr.Http;
@ -94,6 +95,17 @@ namespace Sonarr.Api.V3.EpisodeFiles
{ {
var episodeFile = _mediaFileService.Get(episodeFileResource.Id); var episodeFile = _mediaFileService.Get(episodeFileResource.Id);
episodeFile.Quality = episodeFileResource.Quality; episodeFile.Quality = episodeFileResource.Quality;
if (episodeFileResource.SceneName != null && SceneChecker.IsSceneTitle(episodeFileResource.SceneName))
{
episodeFile.SceneName = episodeFileResource.SceneName;
}
if (episodeFileResource.ReleaseGroup != null)
{
episodeFile.ReleaseGroup = episodeFileResource.ReleaseGroup;
}
_mediaFileService.Update(episodeFile); _mediaFileService.Update(episodeFile);
} }
@ -113,6 +125,16 @@ namespace Sonarr.Api.V3.EpisodeFiles
{ {
episodeFile.Quality = resource.Quality; episodeFile.Quality = resource.Quality;
} }
if (resource.SceneName != null && SceneChecker.IsSceneTitle(resource.SceneName))
{
episodeFile.SceneName = resource.SceneName;
}
if (resource.ReleaseGroup != null)
{
episodeFile.ReleaseGroup = resource.ReleaseGroup;
}
} }
_mediaFileService.Update(episodeFiles); _mediaFileService.Update(episodeFiles);

View File

@ -18,6 +18,7 @@ namespace Sonarr.Api.V3.EpisodeFiles
public long Size { get; set; } public long Size { get; set; }
public DateTime DateAdded { get; set; } public DateTime DateAdded { get; set; }
public string SceneName { get; set; } public string SceneName { get; set; }
public string ReleaseGroup { get; set; }
public Language Language { get; set; } public Language Language { get; set; }
public QualityModel Quality { get; set; } public QualityModel Quality { get; set; }
public MediaInfoResource MediaInfo { get; set; } public MediaInfoResource MediaInfo { get; set; }
@ -43,6 +44,7 @@ namespace Sonarr.Api.V3.EpisodeFiles
Size = model.Size, Size = model.Size,
DateAdded = model.DateAdded, DateAdded = model.DateAdded,
SceneName = model.SceneName, SceneName = model.SceneName,
ReleaseGroup = model.ReleaseGroup,
Language = model.Language, Language = model.Language,
Quality = model.Quality, Quality = model.Quality,
MediaInfo = model.MediaInfo.ToResource(model.SceneName) MediaInfo = model.MediaInfo.ToResource(model.SceneName)
@ -66,6 +68,7 @@ namespace Sonarr.Api.V3.EpisodeFiles
Size = model.Size, Size = model.Size,
DateAdded = model.DateAdded, DateAdded = model.DateAdded,
SceneName = model.SceneName, SceneName = model.SceneName,
ReleaseGroup = model.ReleaseGroup,
Language = model.Language, Language = model.Language,
Quality = model.Quality, Quality = model.Quality,
MediaInfo = model.MediaInfo.ToResource(model.SceneName), MediaInfo = model.MediaInfo.ToResource(model.SceneName),