Merge pull request #993 from tidusjar/dev

Fixed the login issue and pass Radarr the year #990
pull/1028/head
Jamie 8 years ago committed by GitHub
commit 0ccc9d3768

@ -7,7 +7,7 @@ namespace Ombi.Api.Interfaces
{ {
public interface IRadarrApi public interface IRadarrApi
{ {
RadarrAddMovie AddMovie(int tmdbId, string title, int qualityId, string rootPath, string apiKey, Uri baseUrl, bool searchNow = false); RadarrAddMovie AddMovie(int tmdbId, string title, int year, int qualityId, string rootPath, string apiKey, Uri baseUrl, bool searchNow = false);
List<RadarrMovieResponse> GetMovies(string apiKey, Uri baseUrl); List<RadarrMovieResponse> GetMovies(string apiKey, Uri baseUrl);
List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl); List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl);
SystemStatus SystemStatus(string apiKey, Uri baseUrl); SystemStatus SystemStatus(string apiKey, Uri baseUrl);

@ -50,6 +50,7 @@ namespace Ombi.Api.Models.Radarr
public string imdbId { get; set; } public string imdbId { get; set; }
public string titleSlug { get; set; } public string titleSlug { get; set; }
public int id { get; set; } public int id { get; set; }
public int year { get; set; }
} }
} }

@ -63,7 +63,7 @@ namespace Ombi.Api
return obj; return obj;
} }
public RadarrAddMovie AddMovie(int tmdbId, string title, int qualityId, string rootPath, string apiKey, Uri baseUrl, bool searchNow = false) public RadarrAddMovie AddMovie(int tmdbId, string title, int year, int qualityId, string rootPath, string apiKey, Uri baseUrl, bool searchNow = false)
{ {
var request = new RestRequest var request = new RestRequest
{ {
@ -78,7 +78,8 @@ namespace Ombi.Api
qualityProfileId = qualityId, qualityProfileId = qualityId,
rootFolderPath = rootPath, rootFolderPath = rootPath,
titleSlug = title, titleSlug = title,
monitored = true monitored = true,
year = year
}; };
if (searchNow) if (searchNow)

@ -106,7 +106,7 @@ namespace Ombi.Core
{ {
var qualityProfile = 0; var qualityProfile = 0;
int.TryParse(settings.QualityProfile, out qualityProfile); int.TryParse(settings.QualityProfile, out qualityProfile);
var result = RadarrApi.AddMovie(model.ProviderId, model.Title, qualityProfile, settings.RootPath, settings.ApiKey, settings.FullUri, true); var result = RadarrApi.AddMovie(model.ProviderId, model.Title, model.ReleaseDate.Year, qualityProfile, settings.RootPath, settings.ApiKey, settings.FullUri, true);
if (!string.IsNullOrEmpty(result.Error?.message)) if (!string.IsNullOrEmpty(result.Error?.message))
{ {

@ -31,6 +31,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using Nancy; using Nancy;
using Nancy.Security; using Nancy.Security;
using NLog;
using Ombi.Core; using Ombi.Core;
using Ombi.Core.SettingModels; using Ombi.Core.SettingModels;
using Ombi.Helpers; using Ombi.Helpers;
@ -100,6 +101,7 @@ namespace Ombi.UI.Modules
} }
private static Logger Log = LogManager.GetCurrentClassLogger();
private string _username; private string _username;
/// <summary> /// <summary>
/// Returns the Username or UserAlias /// Returns the Username or UserAlias
@ -112,16 +114,17 @@ namespace Ombi.UI.Modules
{ {
try try
{ {
var username = Security.GetUsername(User.UserName, Session); var username = Security.GetUsername(User?.UserName, Session);
if (string.IsNullOrEmpty(username)) if (string.IsNullOrEmpty(username))
{ {
return "Unknown User"; return string.Empty;
} }
_username = username; _username = username;
} }
catch (Exception) catch (Exception e)
{ {
return "Unknown User Error"; Log.Info(e);
return string.Empty;
} }
} }
return _username; return _username;

Loading…
Cancel
Save