Added the option to import the plex admin.

Fixed #1701
This commit is contained in:
tidusjar 2017-11-10 20:27:14 +00:00
parent 1813b45fb3
commit 560072eba4
33 changed files with 279 additions and 91 deletions

View file

@ -18,5 +18,6 @@ namespace Ombi.Api.Plex
Task<PlexMetadata> GetSeasons(string authToken, string plexFullHost, int ratingKey);
Task<PlexContainer> GetAllEpisodes(string authToken, string host, string section, int start, int retCount);
Task<PlexFriends> GetUsers(string authToken);
Task<PlexAccount> GetAccount(string authToken);
}
}

View file

@ -2,13 +2,21 @@
namespace Ombi.Api.Plex.Models
{
public class PlexAccount
{
public User user { get; set; }
}
public class User
{
public string id { get; set; }
public string email { get; set; }
public string uuid { get; set; }
public string joined_at { get; set; }
public string username { get; set; }
public string title { get; set; }
public string thumb { get; set; }
public string hasPassword { get; set; }
public string authentication_token { get; set; }
public Subscription subscription { get; set; }
public Roles roles { get; set; }

View file

@ -18,7 +18,7 @@ namespace Ombi.Api.Plex
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 GetAccountUri = "https://plex.tv/users/account.json";
private const string ServerUri = "https://plex.tv/pms/servers.xml";
/// <summary>
@ -52,6 +52,13 @@ namespace Ombi.Api.Plex
return await Api.Request<PlexStatus>(request);
}
public async Task<PlexAccount> GetAccount(string authToken)
{
var request = new Request(GetAccountUri, string.Empty, HttpMethod.Get);
AddHeaders(request, authToken);
return await Api.Request<PlexAccount>(request);
}
public async Task<PlexServer> GetServer(string authToken)
{
var request = new Request(ServerUri, string.Empty, HttpMethod.Get, ContentType.Xml);