mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
New: Filter Sonarr synchronization based on Root Folders
(cherry picked from commit ff3327483a233ebe54d8f178c355abaeb6f9d11e)
This commit is contained in:
parent
4c2bf285fc
commit
0858f6732a
@ -16,6 +16,7 @@ public class RadarrMovie
|
|||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
public string TitleSlug { get; set; }
|
public string TitleSlug { get; set; }
|
||||||
public int QualityProfileId { get; set; }
|
public int QualityProfileId { get; set; }
|
||||||
|
public string RootFolderPath { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,4 +31,10 @@ public class RadarrTag
|
|||||||
public string Label { get; set; }
|
public string Label { get; set; }
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RadarrRootFolder
|
||||||
|
{
|
||||||
|
public string Path { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,16 +41,27 @@ public override ImportListFetchResult Fetch()
|
|||||||
|
|
||||||
foreach (var remoteMovie in remoteMovies)
|
foreach (var remoteMovie in remoteMovies)
|
||||||
{
|
{
|
||||||
if ((!Settings.ProfileIds.Any() || Settings.ProfileIds.Contains(remoteMovie.QualityProfileId)) &&
|
if (Settings.ProfileIds.Any() && !Settings.ProfileIds.Contains(remoteMovie.QualityProfileId))
|
||||||
(!Settings.TagIds.Any() || Settings.TagIds.Any(x => remoteMovie.Tags.Any(y => y == x))))
|
|
||||||
{
|
{
|
||||||
movies.Add(new ImportListMovie
|
continue;
|
||||||
{
|
|
||||||
TmdbId = remoteMovie.TmdbId,
|
|
||||||
Title = remoteMovie.Title,
|
|
||||||
Year = remoteMovie.Year
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings.TagIds.Any() && !Settings.TagIds.Any(x => remoteMovie.Tags.Any(y => y == x)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Settings.RootFolderPaths.Any() && !Settings.RootFolderPaths.Any(rootFolderPath => remoteMovie.RootFolderPath.ContainsIgnoreCase(rootFolderPath)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
movies.Add(new ImportListMovie
|
||||||
|
{
|
||||||
|
TmdbId = remoteMovie.TmdbId,
|
||||||
|
Title = remoteMovie.Title,
|
||||||
|
Year = remoteMovie.Year
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_importListStatusService.RecordSuccess(Definition.Id);
|
_importListStatusService.RecordSuccess(Definition.Id);
|
||||||
@ -107,6 +118,23 @@ public override object RequestAction(string action, IDictionary<string, string>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action == "getRootFolders")
|
||||||
|
{
|
||||||
|
Settings.Validate().Filter("ApiKey").ThrowOnError();
|
||||||
|
|
||||||
|
var remoteRootfolders = _radarrV3Proxy.GetRootFolders(Settings);
|
||||||
|
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
options = remoteRootfolders.OrderBy(d => d.Path, StringComparer.InvariantCultureIgnoreCase)
|
||||||
|
.Select(d => new
|
||||||
|
{
|
||||||
|
value = d.Path,
|
||||||
|
name = d.Path
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return new { };
|
return new { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ public RadarrSettings()
|
|||||||
ApiKey = "";
|
ApiKey = "";
|
||||||
ProfileIds = Array.Empty<int>();
|
ProfileIds = Array.Empty<int>();
|
||||||
TagIds = Array.Empty<int>();
|
TagIds = Array.Empty<int>();
|
||||||
|
RootFolderPaths = Array.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Radarr instance to import from (Radarr 3.0 or higher)")]
|
[FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Radarr instance to import from (Radarr 3.0 or higher)")]
|
||||||
@ -40,6 +41,9 @@ public RadarrSettings()
|
|||||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getTags", Label = "Tags", HelpText = "Tags from the source instance to import from")]
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getTags", Label = "Tags", HelpText = "Tags from the source instance to import from")]
|
||||||
public IEnumerable<int> TagIds { get; set; }
|
public IEnumerable<int> TagIds { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(4, Type = FieldType.Select, SelectOptionsProviderAction = "getRootFolders", Label = "Root Folders", HelpText = "Root Folders from the source instance to import from")]
|
||||||
|
public IEnumerable<string> RootFolderPaths { get; set; }
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
@ -13,6 +13,7 @@ public interface IRadarrV3Proxy
|
|||||||
{
|
{
|
||||||
List<RadarrMovie> GetMovies(RadarrSettings settings);
|
List<RadarrMovie> GetMovies(RadarrSettings settings);
|
||||||
List<RadarrProfile> GetProfiles(RadarrSettings settings);
|
List<RadarrProfile> GetProfiles(RadarrSettings settings);
|
||||||
|
List<RadarrRootFolder> GetRootFolders(RadarrSettings settings);
|
||||||
List<RadarrTag> GetTags(RadarrSettings settings);
|
List<RadarrTag> GetTags(RadarrSettings settings);
|
||||||
ValidationFailure Test(RadarrSettings settings);
|
ValidationFailure Test(RadarrSettings settings);
|
||||||
}
|
}
|
||||||
@ -38,6 +39,11 @@ public List<RadarrProfile> GetProfiles(RadarrSettings settings)
|
|||||||
return Execute<RadarrProfile>("/api/v3/qualityprofile", settings);
|
return Execute<RadarrProfile>("/api/v3/qualityprofile", settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RadarrRootFolder> GetRootFolders(RadarrSettings settings)
|
||||||
|
{
|
||||||
|
return Execute<RadarrRootFolder>("api/v3/rootfolder", settings);
|
||||||
|
}
|
||||||
|
|
||||||
public List<RadarrTag> GetTags(RadarrSettings settings)
|
public List<RadarrTag> GetTags(RadarrSettings settings)
|
||||||
{
|
{
|
||||||
return Execute<RadarrTag>("/api/v3/tag", settings);
|
return Execute<RadarrTag>("/api/v3/tag", settings);
|
||||||
|
Loading…
Reference in New Issue
Block a user