wip: made a start on the import

pull/4576/head
tidusjar 3 years ago
parent dffadbe9d7
commit 890d74037a

@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Ombi.Api.Plex.Models;
using Ombi.Api.Plex.Models.Friends;
@ -26,5 +27,6 @@ namespace Ombi.Api.Plex
Task<OAuthContainer> GetPin(int pinId);
Task<Uri> GetOAuthUrl(string code, string applicationUrl);
Task<PlexAddWrapper> AddUser(string emailAddress, string serverId, string authToken, int[] libs);
Task<PlexMetadata> GetWatchlist(string plexToken, CancellationToken cancellationToken);
}
}

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Ombi.Api.Plex.Models
{
public class PlexWatchlist
{
public string librarySectionID { get; set; }
public string librarySectionTitle { get; set; }
public int offset { get; set; }
public int totalSize { get; set; }
public int size { get; set; }
public List<Metadata> Metadata { get; set; } = new List<Metadata>();
}
}

@ -1,5 +1,6 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Ombi.Api.Plex.Models;
@ -66,6 +67,7 @@ namespace Ombi.Api.Plex
private const string FriendsUri = "https://plex.tv/pms/friends/all";
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/library/sections/watchlist/all";
/// <summary>
/// Sign into the Plex API
@ -288,6 +290,16 @@ namespace Ombi.Api.Plex
}
}
public async Task<PlexMetadata> GetWatchlist(string plexToken, CancellationToken cancellationToken)
{
var request = new Request(string.Empty, WatchlistUri, HttpMethod.Get);
await AddHeaders(request, plexToken);
var result = await Api.Request<PlexMetadata>(request, cancellationToken);
return result;
}
/// <summary>
/// Adds the required headers and also the authorization header

@ -0,0 +1,6 @@
namespace Ombi.Schedule.Jobs.Plex
{
public interface IPlexWatchlistImport : IBaseJob
{
}
}

@ -0,0 +1,22 @@
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ombi.Schedule.Jobs.Plex
{
public class PlexWatchlistImport : IPlexWatchlistImport
{
public void Dispose()
{
throw new NotImplementedException();
}
public Task Execute(IJobExecutionContext context)
{
throw new NotImplementedException();
}
}
}
Loading…
Cancel
Save