mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
small changes
This commit is contained in:
parent
2b931f15c1
commit
4439f0b41b
2 changed files with 33 additions and 10 deletions
|
@ -64,7 +64,6 @@ namespace Ombi.Api
|
||||||
|
|
||||||
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling GetUsers for Emby, Retrying {0}", timespan), new[] {
|
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling GetUsers for Emby, Retrying {0}", timespan), new[] {
|
||||||
TimeSpan.FromSeconds (1),
|
TimeSpan.FromSeconds (1),
|
||||||
TimeSpan.FromSeconds(5)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var obj = policy.Execute(() => Api.ExecuteJson<List<EmbyUser>>(request, baseUri));
|
var obj = policy.Execute(() => Api.ExecuteJson<List<EmbyUser>>(request, baseUri));
|
||||||
|
@ -199,8 +198,7 @@ namespace Ombi.Api
|
||||||
|
|
||||||
|
|
||||||
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling LogInfor Emby, Retrying {0}", timespan), new[] {
|
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling LogInfor Emby, Retrying {0}", timespan), new[] {
|
||||||
TimeSpan.FromSeconds (1),
|
TimeSpan.FromSeconds (1)
|
||||||
TimeSpan.FromSeconds(5)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var obj = policy.Execute(() => Api.Execute(request, baseUri));
|
var obj = policy.Execute(() => Api.Execute(request, baseUri));
|
||||||
|
|
|
@ -330,7 +330,15 @@ namespace Ombi.UI.Modules
|
||||||
if (settings.UserAuthentication) // Authenticate with Plex
|
if (settings.UserAuthentication) // Authenticate with Plex
|
||||||
{
|
{
|
||||||
Log.Debug("Need to auth and also provide pass");
|
Log.Debug("Need to auth and also provide pass");
|
||||||
var signedIn = (EmbyUser)EmbyApi.LogIn(username, password, embySettings.ApiKey, embySettings.FullUri);
|
EmbyUser signedIn = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
signedIn = (EmbyUser)EmbyApi.LogIn(username, password, embySettings.ApiKey, embySettings.FullUri);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
}
|
||||||
if (signedIn != null)
|
if (signedIn != null)
|
||||||
{
|
{
|
||||||
Log.Debug("Correct credentials, checking if the user is account owner or in the friends list");
|
Log.Debug("Correct credentials, checking if the user is account owner or in the friends list");
|
||||||
|
@ -732,15 +740,32 @@ namespace Ombi.UI.Modules
|
||||||
|
|
||||||
private bool CheckIfEmbyUser(string username, EmbySettings s)
|
private bool CheckIfEmbyUser(string username, EmbySettings s)
|
||||||
{
|
{
|
||||||
var users = EmbyApi.GetUsers(s.FullUri, s.ApiKey);
|
try
|
||||||
var allUsers = users?.Where(x => !string.IsNullOrEmpty(x.Name));
|
{
|
||||||
return allUsers != null && allUsers.Any(x => x.Name.Equals(username, StringComparison.CurrentCultureIgnoreCase));
|
var users = EmbyApi.GetUsers(s.FullUri, s.ApiKey);
|
||||||
|
var allUsers = users?.Where(x => !string.IsNullOrEmpty(x.Name));
|
||||||
|
return allUsers != null && allUsers.Any(x => x.Name.Equals(username, StringComparison.CurrentCultureIgnoreCase));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private EmbyUser GetEmbyUser(string username, EmbySettings s)
|
private EmbyUser GetEmbyUser(string username, EmbySettings s)
|
||||||
{
|
{
|
||||||
var users = EmbyApi.GetUsers(s.FullUri, s.ApiKey);
|
try
|
||||||
var allUsers = users?.Where(x => !string.IsNullOrEmpty(x.Name));
|
{
|
||||||
return allUsers?.FirstOrDefault(x => x.Name.Equals(username, StringComparison.CurrentCultureIgnoreCase));
|
|
||||||
|
var users = EmbyApi.GetUsers(s.FullUri, s.ApiKey);
|
||||||
|
var allUsers = users?.Where(x => !string.IsNullOrEmpty(x.Name));
|
||||||
|
return allUsers?.FirstOrDefault(x => x.Name.Equals(username, StringComparison.CurrentCultureIgnoreCase));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue