mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-04-23 22:07:07 -04:00
Don't allow to set episode files with 'Original' language
This commit is contained in:
parent
79ca5987de
commit
6adc8775aa
1 changed files with 8 additions and 2 deletions
|
@ -1,10 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
@ -153,7 +156,7 @@ namespace Sonarr.Api.V3.EpisodeFiles
|
|||
|
||||
if (episodeFile == null)
|
||||
{
|
||||
throw new NzbDroneClientException(global::System.Net.HttpStatusCode.NotFound, "Episode file not found");
|
||||
throw new NzbDroneClientException(HttpStatusCode.NotFound, "Episode file not found");
|
||||
}
|
||||
|
||||
var series = _seriesService.GetSeries(episodeFile.SeriesId);
|
||||
|
@ -188,7 +191,8 @@ namespace Sonarr.Api.V3.EpisodeFiles
|
|||
|
||||
if (resourceEpisodeFile.Languages != null)
|
||||
{
|
||||
episodeFile.Languages = resourceEpisodeFile.Languages;
|
||||
// Don't allow user to set files with 'Original' language
|
||||
episodeFile.Languages = resourceEpisodeFile.Languages.Where(l => l != null && l != Language.Original).ToList();
|
||||
}
|
||||
|
||||
if (resourceEpisodeFile.Quality != null)
|
||||
|
@ -218,7 +222,9 @@ namespace Sonarr.Api.V3.EpisodeFiles
|
|||
}
|
||||
|
||||
_mediaFileService.Update(episodeFiles);
|
||||
|
||||
var series = _seriesService.GetSeries(episodeFiles.First().SeriesId);
|
||||
|
||||
return Accepted(episodeFiles.ConvertAll(f => f.ToResource(series, _upgradableSpecification, _formatCalculator)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue