mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-26 22:56:23 -04:00
New: Manually import multiple items at the same time from Activity: Queue
This commit is contained in:
@@ -976,6 +976,7 @@
|
||||
"ImportMechanismHandlingDisabledHealthCheckMessage": "Enable Completed Download Handling",
|
||||
"ImportScriptPath": "Import Script Path",
|
||||
"ImportScriptPathHelpText": "The path to the script to use for importing",
|
||||
"ImportSelected": "Import Selected",
|
||||
"ImportSeries": "Import Series",
|
||||
"ImportUsingScript": "Import Using Script",
|
||||
"ImportUsingScriptHelpText": "Copy files for importing using a script (ex. for transcoding)",
|
||||
@@ -1086,6 +1087,7 @@
|
||||
"InstanceNameHelpText": "Instance name in tab and for Syslog app name",
|
||||
"InteractiveImport": "Interactive Import",
|
||||
"InteractiveImportLoadError": "Unable to load manual import items",
|
||||
"InteractiveImportMultipleQueueItems": "Multiple Queue Items",
|
||||
"InteractiveImportNoEpisode": "One or more episodes must be chosen for each selected file",
|
||||
"InteractiveImportNoFilesFound": "No video files were found in the selected folder",
|
||||
"InteractiveImportNoImportMode": "An import mode must be selected",
|
||||
|
||||
@@ -20,14 +20,34 @@ public class ManualImportController : Controller
|
||||
|
||||
[HttpGet]
|
||||
[Produces("application/json")]
|
||||
public List<ManualImportResource> GetMediaFiles(string? folder, string? downloadId, int? seriesId, int? seasonNumber, bool filterExistingFiles = true)
|
||||
public List<ManualImportResource> GetMediaFiles(string? folder, [FromQuery] string[]? downloadIds, int? seriesId, int? seasonNumber, bool filterExistingFiles = true)
|
||||
{
|
||||
if (seriesId.HasValue && downloadId.IsNullOrWhiteSpace())
|
||||
if (seriesId.HasValue && downloadIds == null)
|
||||
{
|
||||
return _manualImportService.GetMediaFiles(seriesId.Value, seasonNumber).ToResource().Select(AddQualityWeight).ToList();
|
||||
return _manualImportService.GetMediaFiles(seriesId.Value, seasonNumber)
|
||||
.ToResource()
|
||||
.Select(AddQualityWeight)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return _manualImportService.GetMediaFiles(folder, downloadId, seriesId, filterExistingFiles).ToResource().Select(AddQualityWeight).ToList();
|
||||
if (downloadIds != null && downloadIds.Any())
|
||||
{
|
||||
var files = new List<ManualImportItem>();
|
||||
|
||||
foreach (var downloadId in downloadIds.Distinct())
|
||||
{
|
||||
files.AddRange(_manualImportService.GetMediaFiles(null, downloadId, seriesId, filterExistingFiles));
|
||||
}
|
||||
|
||||
return files.ToResource()
|
||||
.Select(AddQualityWeight)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return _manualImportService.GetMediaFiles(folder, null, seriesId, filterExistingFiles)
|
||||
.ToResource()
|
||||
.Select(AddQualityWeight)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -52,7 +52,7 @@ public static class ManualImportResourceMapper
|
||||
Size = model.Size,
|
||||
Series = model.Series?.ToResource(),
|
||||
SeasonNumber = model.SeasonNumber,
|
||||
Episodes = model.Episodes.ToResource(),
|
||||
Episodes = model.Episodes?.ToResource() ?? [],
|
||||
EpisodeFileId = model.EpisodeFileId,
|
||||
ReleaseGroup = model.ReleaseGroup,
|
||||
Quality = model.Quality,
|
||||
|
||||
Reference in New Issue
Block a user