mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
#459 is almost done
This commit is contained in:
parent
0a97d9e256
commit
d843ab0ebb
11 changed files with 605 additions and 45 deletions
|
@ -56,6 +56,7 @@ namespace PlexRequests.Api
|
|||
private const string SignInUri = "https://plex.tv/users/sign_in.json";
|
||||
private const string FriendsUri = "https://plex.tv/pms/friends/all";
|
||||
private const string GetAccountUri = "https://plex.tv/users/account";
|
||||
private const string ServerUri = "https://plex.tv/pms/servers.xml";
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private static string Version { get; }
|
||||
|
@ -87,18 +88,18 @@ namespace PlexRequests.Api
|
|||
|
||||
public PlexFriends GetUsers(string authToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
};
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
};
|
||||
|
||||
AddHeaders(ref request, authToken);
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
var users = RetryHandler.Execute(() => Api.ExecuteXml<PlexFriends> (request, new Uri(FriendsUri)),
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetUsers for Plex, Retrying {0}", timespan), null);
|
||||
var users = RetryHandler.Execute(() => Api.ExecuteXml<PlexFriends> (request, new Uri(FriendsUri)),
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetUsers for Plex, Retrying {0}", timespan), null);
|
||||
|
||||
|
||||
return users;
|
||||
return users;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -300,6 +301,22 @@ namespace PlexRequests.Api
|
|||
}
|
||||
}
|
||||
|
||||
public PlexServer GetServer(string authToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
};
|
||||
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
var servers = RetryHandler.Execute(() => Api.ExecuteXml<PlexServer>(request, new Uri(ServerUri)),
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetServer for Plex, Retrying {0}", timespan));
|
||||
|
||||
|
||||
return servers;
|
||||
}
|
||||
|
||||
private void AddHeaders(ref RestRequest request, string authToken)
|
||||
{
|
||||
request.AddHeader("X-Plex-Token", authToken);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue