mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
wip: made a start on the import
This commit is contained in:
parent
dffadbe9d7
commit
890d74037a
5 changed files with 56 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Ombi.Api.Plex.Models;
|
using Ombi.Api.Plex.Models;
|
||||||
using Ombi.Api.Plex.Models.Friends;
|
using Ombi.Api.Plex.Models.Friends;
|
||||||
|
@ -26,5 +27,6 @@ namespace Ombi.Api.Plex
|
||||||
Task<OAuthContainer> GetPin(int pinId);
|
Task<OAuthContainer> GetPin(int pinId);
|
||||||
Task<Uri> GetOAuthUrl(string code, string applicationUrl);
|
Task<Uri> GetOAuthUrl(string code, string applicationUrl);
|
||||||
Task<PlexAddWrapper> AddUser(string emailAddress, string serverId, string authToken, int[] libs);
|
Task<PlexAddWrapper> AddUser(string emailAddress, string serverId, string authToken, int[] libs);
|
||||||
|
Task<PlexMetadata> GetWatchlist(string plexToken, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
14
src/Ombi.Api.Plex/Models/PlexWatchlist.cs
Normal file
14
src/Ombi.Api.Plex/Models/PlexWatchlist.cs
Normal file
|
@ -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;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Ombi.Api.Plex.Models;
|
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 FriendsUri = "https://plex.tv/pms/friends/all";
|
||||||
private const string GetAccountUri = "https://plex.tv/users/account.json";
|
private const string GetAccountUri = "https://plex.tv/users/account.json";
|
||||||
private const string ServerUri = "https://plex.tv/pms/servers.xml";
|
private const string ServerUri = "https://plex.tv/pms/servers.xml";
|
||||||
|
private const string WatchlistUri = "https://metadata.provider.plex.tv/library/sections/watchlist/all";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sign into the Plex API
|
/// 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>
|
/// <summary>
|
||||||
/// Adds the required headers and also the authorization header
|
/// Adds the required headers and also the authorization header
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace Ombi.Schedule.Jobs.Plex
|
||||||
|
{
|
||||||
|
public interface IPlexWatchlistImport : IBaseJob
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
22
src/Ombi.Schedule/Jobs/Plex/PlexWatchlistImport.cs
Normal file
22
src/Ombi.Schedule/Jobs/Plex/PlexWatchlistImport.cs
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue