|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
@ -599,6 +600,7 @@ namespace MediaBrowser.Api.LiveTv
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public bool ValidateLogin { get; set; }
|
|
|
|
public bool ValidateLogin { get; set; }
|
|
|
|
public bool ValidateListings { get; set; }
|
|
|
|
public bool ValidateListings { get; set; }
|
|
|
|
|
|
|
|
public string Pw { get; set; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Route("/LiveTv/ListingProviders", "DELETE", Summary = "Deletes a listing provider")]
|
|
|
|
[Route("/LiveTv/ListingProviders", "DELETE", Summary = "Deletes a listing provider")]
|
|
|
@ -866,10 +868,30 @@ namespace MediaBrowser.Api.LiveTv
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<object> Post(AddListingProvider request)
|
|
|
|
public async Task<object> Post(AddListingProvider request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (request.Pw != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
request.Password = GetHashedString(request.Pw);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
request.Pw = null;
|
|
|
|
|
|
|
|
|
|
|
|
var result = await _liveTvManager.SaveListingProvider(request, request.ValidateLogin, request.ValidateListings).ConfigureAwait(false);
|
|
|
|
var result = await _liveTvManager.SaveListingProvider(request, request.ValidateLogin, request.ValidateListings).ConfigureAwait(false);
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
return ToOptimizedResult(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets the hashed string.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private string GetHashedString(string str)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// SchedulesDirect requires a SHA1 hash of the user's password
|
|
|
|
|
|
|
|
// https://github.com/SchedulesDirect/JSON-Service/wiki/API-20141201#obtain-a-token
|
|
|
|
|
|
|
|
SHA1 sha = SHA1.Create();
|
|
|
|
|
|
|
|
return BitConverter.ToString(
|
|
|
|
|
|
|
|
sha.ComputeHash(Encoding.UTF8.GetBytes(str)))
|
|
|
|
|
|
|
|
.Replace("-", string.Empty).ToLowerInvariant();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Delete(DeleteListingProvider request)
|
|
|
|
public void Delete(DeleteListingProvider request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_liveTvManager.DeleteListingsProvider(request.Id);
|
|
|
|
_liveTvManager.DeleteListingsProvider(request.Id);
|
|
|
|