update schedules direct
This commit is contained in:
parent
6a6145294a
commit
14f97d6176
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
|
@ -10,6 +9,7 @@ using MediaBrowser.Model.LiveTv;
|
|||
using MediaBrowser.Model.Querying;
|
||||
using ServiceStack;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
@ -350,6 +350,8 @@ namespace MediaBrowser.Api.LiveTv
|
|||
[Authenticated]
|
||||
public class AddListingProvider : ListingsProviderInfo, IReturn<ListingsProviderInfo>
|
||||
{
|
||||
public bool ValidateLogin { get; set; }
|
||||
public bool ValidateListings { get; set; }
|
||||
}
|
||||
|
||||
[Route("/LiveTv/ListingProviders", "DELETE", Summary = "Deletes a listing provider")]
|
||||
|
@ -402,9 +404,9 @@ namespace MediaBrowser.Api.LiveTv
|
|||
}
|
||||
}
|
||||
|
||||
public object Post(AddListingProvider request)
|
||||
public async Task<object> Post(AddListingProvider request)
|
||||
{
|
||||
var result = _liveTvManager.SaveListingProvider(request).Result;
|
||||
var result = await _liveTvManager.SaveListingProvider(request, request.ValidateLogin, request.ValidateListings).ConfigureAwait(false);
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -819,11 +819,11 @@ namespace MediaBrowser.Api.Playback
|
|||
/// <summary>
|
||||
/// Gets the audio encoder.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
protected string GetAudioEncoder(StreamRequest request)
|
||||
protected string GetAudioEncoder(StreamState state)
|
||||
{
|
||||
var codec = request.AudioCodec;
|
||||
var codec = state.OutputAudioCodec;
|
||||
|
||||
if (string.Equals(codec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -848,11 +848,11 @@ namespace MediaBrowser.Api.Playback
|
|||
/// <summary>
|
||||
/// Gets the name of the output video codec
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
protected string GetVideoEncoder(VideoStreamRequest request)
|
||||
protected string GetVideoEncoder(StreamState state)
|
||||
{
|
||||
var codec = request.VideoCodec;
|
||||
var codec = state.OutputVideoCodec;
|
||||
|
||||
if (!string.IsNullOrEmpty(codec))
|
||||
{
|
||||
|
|
|
@ -378,7 +378,7 @@ namespace MediaBrowser.Api.Playback.Dash
|
|||
|
||||
protected override string GetAudioArguments(StreamState state)
|
||||
{
|
||||
var codec = GetAudioEncoder(state.Request);
|
||||
var codec = GetAudioEncoder(state);
|
||||
|
||||
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -408,7 +408,7 @@ namespace MediaBrowser.Api.Playback.Dash
|
|||
|
||||
protected override string GetVideoArguments(StreamState state)
|
||||
{
|
||||
var codec = GetVideoEncoder(state.VideoRequest);
|
||||
var codec = GetVideoEncoder(state);
|
||||
|
||||
var args = "-codec:v:0 " + codec;
|
||||
|
||||
|
|
|
@ -791,7 +791,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
|
||||
protected override string GetAudioArguments(StreamState state)
|
||||
{
|
||||
var codec = GetAudioEncoder(state.Request);
|
||||
var codec = GetAudioEncoder(state);
|
||||
|
||||
if (!state.IsOutputVideo)
|
||||
{
|
||||
|
@ -856,7 +856,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
var codec = GetVideoEncoder(state.VideoRequest);
|
||||
var codec = GetVideoEncoder(state);
|
||||
|
||||
var args = "-codec:v:0 " + codec;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
/// <returns>System.String.</returns>
|
||||
protected override string GetAudioArguments(StreamState state)
|
||||
{
|
||||
var codec = GetAudioEncoder(state.Request);
|
||||
var codec = GetAudioEncoder(state);
|
||||
|
||||
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
/// <returns>System.String.</returns>
|
||||
protected override string GetVideoArguments(StreamState state)
|
||||
{
|
||||
var codec = GetVideoEncoder(state.VideoRequest);
|
||||
var codec = GetVideoEncoder(state);
|
||||
|
||||
var args = "-codec:v:0 " + codec;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding)
|
||||
{
|
||||
// Get the output codec name
|
||||
var videoCodec = GetVideoEncoder(state.VideoRequest);
|
||||
var videoCodec = GetVideoEncoder(state);
|
||||
|
||||
var format = string.Empty;
|
||||
var keyFrame = string.Empty;
|
||||
|
@ -183,7 +183,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||
}
|
||||
|
||||
// Get the output codec name
|
||||
var codec = GetAudioEncoder(state.Request);
|
||||
var codec = GetAudioEncoder(state);
|
||||
|
||||
var args = "-codec:a:0 " + codec;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
string Type { get; }
|
||||
Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);
|
||||
Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken);
|
||||
Task Validate(ListingsProviderInfo info);
|
||||
Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings);
|
||||
Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,8 +349,10 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// Saves the listing provider.
|
||||
/// </summary>
|
||||
/// <param name="info">The information.</param>
|
||||
/// <param name="validateLogin">if set to <c>true</c> [validate login].</param>
|
||||
/// <param name="validateListings">if set to <c>true</c> [validate listings].</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info);
|
||||
Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings);
|
||||
/// <summary>
|
||||
/// Gets the lineups.
|
||||
/// </summary>
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
}
|
||||
}
|
||||
|
||||
AddCover(item, null, element);
|
||||
AddCover(item, context, null, element);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
|
||||
AddCommonFields(folder, stubType, null, container, filter);
|
||||
|
||||
AddCover(folder, stubType, container);
|
||||
AddCover(folder, context, stubType, container);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
}
|
||||
}
|
||||
|
||||
private void AddCover(BaseItem item, StubType? stubType, XmlElement element)
|
||||
private void AddCover(BaseItem item, BaseItem context, StubType? stubType, XmlElement element)
|
||||
{
|
||||
if (stubType.HasValue && stubType.Value == StubType.People)
|
||||
{
|
||||
|
@ -772,7 +772,26 @@ namespace MediaBrowser.Dlna.Didl
|
|||
return;
|
||||
}
|
||||
|
||||
var imageInfo = GetImageInfo(item);
|
||||
ImageDownloadInfo imageInfo = null;
|
||||
|
||||
if (context is UserView)
|
||||
{
|
||||
var episode = item as Episode;
|
||||
if (episode != null)
|
||||
{
|
||||
var parent = (BaseItem)episode.Series ?? episode.Season;
|
||||
if (parent != null)
|
||||
{
|
||||
imageInfo = GetImageInfo(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, just use the image from the item
|
||||
if (imageInfo == null)
|
||||
{
|
||||
imageInfo = GetImageInfo(item);
|
||||
}
|
||||
|
||||
if (imageInfo == null)
|
||||
{
|
||||
|
@ -850,7 +869,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
private void AddEmbeddedImageAsCover(string name, XmlElement element)
|
||||
{
|
||||
var result = element.OwnerDocument;
|
||||
|
||||
|
||||
var icon = result.CreateElement("upnp", "albumArtURI", NS_UPNP);
|
||||
var profile = result.CreateAttribute("dlna", "profileID", NS_DLNA);
|
||||
profile.InnerText = _profile.AlbumArtPn;
|
||||
|
@ -925,14 +944,11 @@ namespace MediaBrowser.Dlna.Didl
|
|||
}
|
||||
}
|
||||
|
||||
if (item is Audio || item is Episode)
|
||||
{
|
||||
item = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
||||
item = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
return GetImageInfo(item, ImageType.Primary);
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
return GetImageInfo(item, ImageType.Primary);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -400,13 +400,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
|
||||
_logger.Info("Headends on account ");
|
||||
|
||||
var countryParam = string.Equals("ca", country, StringComparison.OrdinalIgnoreCase)
|
||||
? "can"
|
||||
: "USA";
|
||||
|
||||
var options = new HttpRequestOptions()
|
||||
{
|
||||
Url = ApiUrl + "/headends?country=" + countryParam + "&postalcode=" + location,
|
||||
Url = ApiUrl + "/headends?country=" + country + "&postalcode=" + location,
|
||||
UserAgent = UserAgent,
|
||||
CancellationToken = cancellationToken
|
||||
};
|
||||
|
@ -595,18 +591,32 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
}
|
||||
}
|
||||
|
||||
public async Task Validate(ListingsProviderInfo info)
|
||||
public async Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(info.ListingsId))
|
||||
if (validateLogin)
|
||||
{
|
||||
throw new ArgumentException("Listings Id required");
|
||||
if (string.IsNullOrWhiteSpace(info.Username))
|
||||
{
|
||||
throw new ArgumentException("Username is required");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(info.Password))
|
||||
{
|
||||
throw new ArgumentException("Password is required");
|
||||
}
|
||||
}
|
||||
|
||||
var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
if (!hasLineup)
|
||||
if (validateListings)
|
||||
{
|
||||
await AddLineupToAccount(info, CancellationToken.None).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(info.ListingsId))
|
||||
{
|
||||
throw new ArgumentException("Listings Id required");
|
||||
}
|
||||
|
||||
var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
if (!hasLineup)
|
||||
{
|
||||
await AddLineupToAccount(info, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
// Might not be needed
|
||||
}
|
||||
|
||||
public Task Validate(ListingsProviderInfo info)
|
||||
public async Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||
{
|
||||
// Check that the path or url is valid. If not, throw a file not found exception
|
||||
}
|
||||
|
|
|
@ -2204,7 +2204,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
|
||||
}
|
||||
|
||||
public async Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info)
|
||||
public async Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||
{
|
||||
info = (ListingsProviderInfo)_jsonSerializer.DeserializeFromString(_jsonSerializer.SerializeToString(info), typeof(ListingsProviderInfo));
|
||||
|
||||
|
@ -2215,7 +2215,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
throw new ResourceNotFoundException();
|
||||
}
|
||||
|
||||
await provider.Validate(info).ConfigureAwait(false);
|
||||
await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false);
|
||||
|
||||
var config = GetConfiguration();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user