1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

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 @@ public class EpisodeFileListResource
public List<int> EpisodeFileIds { get; set; }
public Language Language { 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.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
using NzbDrone.SignalR;
using Sonarr.Http;
@ -94,6 +95,17 @@ private void SetQuality(EpisodeFileResource episodeFileResource)
{
var episodeFile = _mediaFileService.Get(episodeFileResource.Id);
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);
}
@ -113,6 +125,16 @@ private object SetQuality()
{
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);

View File

@ -18,6 +18,7 @@ public class EpisodeFileResource : RestResource
public long Size { get; set; }
public DateTime DateAdded { get; set; }
public string SceneName { get; set; }
public string ReleaseGroup { get; set; }
public Language Language { get; set; }
public QualityModel Quality { get; set; }
public MediaInfoResource MediaInfo { get; set; }
@ -43,6 +44,7 @@ private static EpisodeFileResource ToResource(this EpisodeFile model)
Size = model.Size,
DateAdded = model.DateAdded,
SceneName = model.SceneName,
ReleaseGroup = model.ReleaseGroup,
Language = model.Language,
Quality = model.Quality,
MediaInfo = model.MediaInfo.ToResource(model.SceneName)
@ -66,6 +68,7 @@ public static EpisodeFileResource ToResource(this EpisodeFile model, NzbDrone.Co
Size = model.Size,
DateAdded = model.DateAdded,
SceneName = model.SceneName,
ReleaseGroup = model.ReleaseGroup,
Language = model.Language,
Quality = model.Quality,
MediaInfo = model.MediaInfo.ToResource(model.SceneName),