fix(user-importer): Fixed not importing all correct users #4989

pull/4993/head
tidusjar 1 year ago
parent 880e511f2b
commit 34c32f8338

@ -16,6 +16,10 @@ namespace Ombi.Api.Plex.Models.Friends
public string Username { get; set; }
[XmlAttribute(AttributeName = "email")]
public string Email { get; set; }
/// <summary>
/// DO NOT USE THIS
/// Home Users can actually be an unmanaged account with an email/username to log in.
/// </summary>
[XmlAttribute(AttributeName = "home")]
public bool HomeUser { get; set; }
}

@ -65,8 +65,7 @@ namespace Ombi.Api.Plex
}
private const string SignInUri = "https://plex.tv/users/sign_in.json";
private const string NewFriendsUri = "https://plex.tv/api/users";
private const string FriendsUri = "https://plex.tv/pms/friends/all";
private const string FriendsUri = "https://plex.tv/api/users";
private const string GetAccountUri = "https://plex.tv/users/account.json";
private const string ServerUri = "https://plex.tv/pms/servers.xml";
private const string WatchlistUri = "https://metadata.provider.plex.tv/";

@ -127,19 +127,14 @@ namespace Ombi.Schedule.Jobs.Plex
continue;
}
if (plexUser.HomeUser)
{
_log.LogInformation($"User '{plexUser.Title}' is a Plex Home User. Home Users are not supported");
continue;
}
// Check if this Plex User already exists
// We are using the Plex USERNAME and Not the TITLE, the Title is for HOME USERS without an account
var existingPlexUser = allUsers.FirstOrDefault(x => x.ProviderUserId == plexUser.Id);
if (existingPlexUser == null)
{
if (!plexUser.Username.HasValue())
{
_log.LogInformation($"Could not create Plex user since the have no username, PlexUserId: {plexUser.Id}");
_log.LogInformation($"Could not create user since the have no username (Probably a Home User), PlexUserId: {plexUser.Id}, Title: {plexUser.Title}");
continue;
}

Loading…
Cancel
Save