Removed the V3 switch from Radarr, no one is using V2 Radarr anymore.

pull/4220/head v4.0.1404
tidusjar 4 years ago
parent 9dbadc17af
commit 5e33088a6d

@ -125,7 +125,6 @@ namespace Ombi.Core.Senders
private async Task<SenderResult> SendToRadarr(MovieRequests model, RadarrSettings settings) private async Task<SenderResult> SendToRadarr(MovieRequests model, RadarrSettings settings)
{ {
var v3 = settings.V3;
var qualityToUse = int.Parse(settings.DefaultQualityProfile); var qualityToUse = int.Parse(settings.DefaultQualityProfile);
var rootFolderPath = settings.DefaultRootPath; var rootFolderPath = settings.DefaultRootPath;
@ -159,30 +158,16 @@ namespace Ombi.Core.Senders
List<MovieResponse> movies; List<MovieResponse> movies;
// Check if the movie already exists? Since it could be unmonitored // Check if the movie already exists? Since it could be unmonitored
if (settings.V3)
{
movies = await _radarrV3Api.GetMovies(settings.ApiKey, settings.FullUri); movies = await _radarrV3Api.GetMovies(settings.ApiKey, settings.FullUri);
}
else
{
movies = await _radarrV2Api.GetMovies(settings.ApiKey, settings.FullUri);
}
var existingMovie = movies.FirstOrDefault(x => x.tmdbId == model.TheMovieDbId); var existingMovie = movies.FirstOrDefault(x => x.tmdbId == model.TheMovieDbId);
if (existingMovie == null) if (existingMovie == null)
{ {
RadarrAddMovie result; var result = await _radarrV3Api.AddMovie(model.TheMovieDbId, model.Title, model.ReleaseDate.Year,
if (v3)
{
result = await _radarrV3Api.AddMovie(model.TheMovieDbId, model.Title, model.ReleaseDate.Year,
qualityToUse, rootFolderPath, settings.ApiKey, settings.FullUri, !settings.AddOnly, qualityToUse, rootFolderPath, settings.ApiKey, settings.FullUri, !settings.AddOnly,
settings.MinimumAvailability); settings.MinimumAvailability);
}
else
{
result = await _radarrV2Api.AddMovie(model.TheMovieDbId, model.Title, model.ReleaseDate.Year,
qualityToUse, rootFolderPath, settings.ApiKey, settings.FullUri, !settings.AddOnly,
settings.MinimumAvailability);
}
if (!string.IsNullOrEmpty(result.Error?.message)) if (!string.IsNullOrEmpty(result.Error?.message))
{ {
_log.LogError(LoggingEvents.RadarrCacher, result.Error.message); _log.LogError(LoggingEvents.RadarrCacher, result.Error.message);
@ -199,24 +184,13 @@ namespace Ombi.Core.Senders
{ {
// let's set it to monitored and search for it // let's set it to monitored and search for it
existingMovie.monitored = true; existingMovie.monitored = true;
if (v3)
{
await _radarrV3Api.UpdateMovie(existingMovie, settings.ApiKey, settings.FullUri); await _radarrV3Api.UpdateMovie(existingMovie, settings.ApiKey, settings.FullUri);
// Search for it // Search for it
if (!settings.AddOnly) if (!settings.AddOnly)
{ {
await _radarrV3Api.MovieSearch(new[] { existingMovie.id }, settings.ApiKey, settings.FullUri); await _radarrV3Api.MovieSearch(new[] { existingMovie.id }, settings.ApiKey, settings.FullUri);
} }
}
else
{
await _radarrV2Api.UpdateMovie(existingMovie, settings.ApiKey, settings.FullUri);
// Search for it
if (!settings.AddOnly)
{
await _radarrV2Api.MovieSearch(new[] { existingMovie.id }, settings.ApiKey, settings.FullUri);
}
}
return new SenderResult { Success = true, Sent = true }; return new SenderResult { Success = true, Sent = true };
} }
@ -225,19 +199,10 @@ namespace Ombi.Core.Senders
} }
private async Task<string> RadarrRootPath(int overrideId, RadarrSettings settings) private async Task<string> RadarrRootPath(int overrideId, RadarrSettings settings)
{
if (settings.V3)
{ {
var paths = await _radarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri); var paths = await _radarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri);
var selectedPath = paths.FirstOrDefault(x => x.id == overrideId); var selectedPath = paths.FirstOrDefault(x => x.id == overrideId);
return selectedPath?.path ?? string.Empty; return selectedPath?.path ?? string.Empty;
} }
else
{
var paths = await _radarrV2Api.GetRootFolders(settings.ApiKey, settings.FullUri);
var selectedPath = paths.FirstOrDefault(x => x.id == overrideId);
return selectedPath?.path ?? string.Empty;
}
}
} }
} }

@ -3,7 +3,6 @@
public class RadarrSettings : ExternalSettings public class RadarrSettings : ExternalSettings
{ {
public bool Enabled { get; set; } public bool Enabled { get; set; }
public bool V3 { get; set; }
public string ApiKey { get; set; } public string ApiKey { get; set; }
public string DefaultQualityProfile { get; set; } public string DefaultQualityProfile { get; set; }
public string DefaultRootPath { get; set; } public string DefaultRootPath { get; set; }

@ -116,7 +116,6 @@ export interface IRadarrSettings extends IExternalSettings {
addOnly: boolean; addOnly: boolean;
minimumAvailability: string; minimumAvailability: string;
scanForAvailability: boolean; scanForAvailability: boolean;
v3: boolean;
} }
export interface ILidarrSettings extends IExternalSettings { export interface ILidarrSettings extends IExternalSettings {

@ -10,9 +10,6 @@
<div class="md-form-field"> <div class="md-form-field">
<mat-slide-toggle formControlName="enabled" id="enable">Enable</mat-slide-toggle> <mat-slide-toggle formControlName="enabled" id="enable">Enable</mat-slide-toggle>
</div> </div>
<div class="md-form-field">
<mat-slide-toggle formControlName="v3">V3</mat-slide-toggle>
</div>
<div class="md-form-field"> <div class="md-form-field">
<mat-slide-toggle formControlName="scanForAvailability">Scan for Availability</mat-slide-toggle> <mat-slide-toggle formControlName="scanForAvailability">Scan for Availability</mat-slide-toggle>
</div> </div>

@ -42,8 +42,7 @@ export class RadarrComponent implements OnInit {
port: [x.port, [Validators.required]], port: [x.port, [Validators.required]],
addOnly: [x.addOnly], addOnly: [x.addOnly],
minimumAvailability: [x.minimumAvailability, [Validators.required]], minimumAvailability: [x.minimumAvailability, [Validators.required]],
scanForAvailability: [x.scanForAvailability], scanForAvailability: [x.scanForAvailability]
v3: [x.v3 ?? true]
}); });
if (x.defaultQualityProfile) { if (x.defaultQualityProfile) {

@ -39,13 +39,9 @@ namespace Ombi.Controllers.V1.External
[HttpPost("Profiles")] [HttpPost("Profiles")]
[PowerUser] [PowerUser]
public async Task<IActionResult> GetProfiles([FromBody] RadarrSettings settings) public async Task<IActionResult> GetProfiles([FromBody] RadarrSettings settings)
{
if (settings.V3)
{ {
return Ok(await _radarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri)); return Ok(await _radarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri));
} }
return Ok(await _radarrApi.GetProfiles(settings.ApiKey, settings.FullUri));
}
[HttpGet("enabled")] [HttpGet("enabled")]
[PowerUser] [PowerUser]
@ -63,13 +59,9 @@ namespace Ombi.Controllers.V1.External
[HttpPost("RootFolders")] [HttpPost("RootFolders")]
[PowerUser] [PowerUser]
public async Task<IEnumerable<RadarrRootFolder>> GetRootFolders([FromBody] RadarrSettings settings) public async Task<IEnumerable<RadarrRootFolder>> GetRootFolders([FromBody] RadarrSettings settings)
{
if (settings.V3)
{ {
return await _radarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri); return await _radarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri);
} }
return await _radarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
}
/// <summary> /// <summary>
/// Gets the Radarr profiles using the saved settings /// Gets the Radarr profiles using the saved settings
@ -82,13 +74,9 @@ namespace Ombi.Controllers.V1.External
{ {
var settings = await _radarrSettings.GetSettingsAsync(); var settings = await _radarrSettings.GetSettingsAsync();
if (settings.Enabled) if (settings.Enabled)
{
if (settings.V3)
{ {
return Ok(await _radarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri)); return Ok(await _radarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri));
} }
return Ok(await _radarrApi.GetProfiles(settings.ApiKey, settings.FullUri));
}
return null; return null;
} }
@ -103,13 +91,9 @@ namespace Ombi.Controllers.V1.External
{ {
var settings = await _radarrSettings.GetSettingsAsync(); var settings = await _radarrSettings.GetSettingsAsync();
if (settings.Enabled) if (settings.Enabled)
{
if (settings.V3)
{ {
return await _radarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri); return await _radarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri);
} }
return await _radarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
}
return null; return null;
} }

@ -22,7 +22,7 @@
}, },
"Ombi": { "Ombi": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "--host http://localhost:3577", "commandLineArgs": "--host http://localhost:3577 --demo true",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },

Loading…
Cancel
Save