update images
This commit is contained in:
parent
492f897f81
commit
32babe2b94
|
@ -17,15 +17,15 @@ namespace Emby.Drawing.ImageMagick
|
|||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IApplicationPaths _appPaths;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IFileSystem fileSystem)
|
||||
{
|
||||
_logger = logger;
|
||||
_appPaths = appPaths;
|
||||
_httpClient = httpClient;
|
||||
_fileSystem = fileSystem;
|
||||
_fileSystem = fileSystem;
|
||||
|
||||
LogImageMagickVersion();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ namespace Emby.Drawing.ImageMagick
|
|||
try
|
||||
{
|
||||
var tmpPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".webp");
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
|
||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(tmpPath));
|
||||
|
||||
using (var wand = new MagickWand(1, 1, new PixelWand("none", 1)))
|
||||
{
|
||||
|
@ -104,6 +104,7 @@ namespace Emby.Drawing.ImageMagick
|
|||
wand.CurrentImage.TrimImage(10);
|
||||
wand.SaveImage(outputPath);
|
||||
}
|
||||
SaveDelay();
|
||||
}
|
||||
|
||||
public ImageSize GetImageSize(string path)
|
||||
|
@ -163,6 +164,7 @@ namespace Emby.Drawing.ImageMagick
|
|||
}
|
||||
}
|
||||
}
|
||||
SaveDelay();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -185,7 +187,7 @@ namespace Emby.Drawing.ImageMagick
|
|||
{
|
||||
var currentImageSize = new ImageSize(imageWidth, imageHeight);
|
||||
|
||||
var task = new PlayedIndicatorDrawer(_appPaths, _httpClient, _fileSystem).DrawPlayedIndicator(wand, currentImageSize);
|
||||
var task = new PlayedIndicatorDrawer(_appPaths, _httpClient, _fileSystem).DrawPlayedIndicator(wand, currentImageSize);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
else if (options.UnplayedCount.HasValue)
|
||||
|
@ -223,6 +225,15 @@ namespace Emby.Drawing.ImageMagick
|
|||
{
|
||||
new StripCollageBuilder(_appPaths, _fileSystem).BuildPosterCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height, options.Text);
|
||||
}
|
||||
|
||||
SaveDelay();
|
||||
}
|
||||
|
||||
private void SaveDelay()
|
||||
{
|
||||
// For some reason the images are not always getting released right away
|
||||
var task = Task.Delay(300);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
|
|
@ -238,9 +238,6 @@ namespace Emby.Drawing
|
|||
imageProcessingLockTaken = true;
|
||||
|
||||
_imageEncoder.EncodeImage(originalImagePath, cacheFilePath, newWidth, newHeight, quality, options);
|
||||
|
||||
// ImageMagick doesn't seem to always release it right away
|
||||
await Task.Delay(300).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -7,7 +7,5 @@ namespace MediaBrowser.Controller.Channels
|
|||
string ChannelId { get; set; }
|
||||
|
||||
string ExternalId { get; set; }
|
||||
|
||||
string ExternalImagePath { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,13 +185,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supply the image path if it can be accessed directly from the file system
|
||||
/// </summary>
|
||||
/// <value>The image path.</value>
|
||||
[IgnoreDataMember]
|
||||
public string ExternalImagePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the etag.
|
||||
/// </summary>
|
||||
|
|
|
@ -247,7 +247,18 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="file">The file.</param>
|
||||
public static void SetImagePath(this IHasImages item, ImageType imageType, string file)
|
||||
{
|
||||
item.SetImagePath(imageType, BaseItem.FileSystem.GetFileInfo(file));
|
||||
if (file.StartsWith("http", System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
item.SetImage(new ItemImageInfo
|
||||
{
|
||||
Path = file,
|
||||
Type = imageType
|
||||
}, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SetImagePath(imageType, BaseItem.FileSystem.GetFileInfo(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
|
||||
bool CanDelete(User user);
|
||||
|
||||
string ExternalImagePath { get; set; }
|
||||
|
||||
string SeriesTimerId { get; set; }
|
||||
RecordingStatus Status { get; set; }
|
||||
DateTime? EndDate { get; set; }
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Channels
|
||||
{
|
||||
public class ChannelItemImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ChannelItemImageProvider(IHttpClient httpClient, ILogger logger)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
||||
{
|
||||
return new[] { ImageType.Primary };
|
||||
}
|
||||
|
||||
public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
|
||||
{
|
||||
var channelItem = (IChannelItem)item;
|
||||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(channelItem.ExternalImagePath))
|
||||
{
|
||||
imageResponse.Path = channelItem.ExternalImagePath;
|
||||
imageResponse.Protocol = MediaProtocol.Http;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
|
||||
return imageResponse;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Channel Image Provider"; }
|
||||
}
|
||||
|
||||
public bool Supports(IHasImages item)
|
||||
{
|
||||
return item is IChannelItem;
|
||||
}
|
||||
|
||||
public bool HasChanged(IHasMetadata item, MetadataStatus status, IDirectoryService directoryService)
|
||||
{
|
||||
var channelItem = item as IChannelItem;
|
||||
|
||||
if (channelItem != null)
|
||||
{
|
||||
return !channelItem.HasImage(ImageType.Primary) && !string.IsNullOrWhiteSpace(channelItem.ExternalImagePath);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -216,9 +216,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
|
||||
try
|
||||
{
|
||||
var item = await GetChannel(channelInfo, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
_libraryManager.RegisterItem(item);
|
||||
await GetChannel(channelInfo, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -246,8 +244,6 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
if (item == null)
|
||||
{
|
||||
item = GetChannel(channel, CancellationToken.None).Result;
|
||||
|
||||
_libraryManager.RegisterItem(item);
|
||||
}
|
||||
|
||||
return item;
|
||||
|
@ -463,7 +459,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
{
|
||||
item.Name = channelInfo.Name;
|
||||
}
|
||||
|
||||
|
||||
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
ForceSave = isNew
|
||||
|
@ -1264,7 +1260,6 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
|
||||
var channelItem = (IChannelItem)item;
|
||||
|
||||
channelItem.ExternalImagePath = info.ImageUrl;
|
||||
channelItem.ChannelId = internalChannelId.ToString("N");
|
||||
|
||||
if (!string.Equals(channelItem.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase))
|
||||
|
@ -1291,12 +1286,19 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
item.Path = mediaSource == null ? null : mediaSource.Path;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(info.ImageUrl))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, info.ImageUrl);
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
_libraryManager.RegisterItem(item);
|
||||
|
||||
await _libraryManager.UpdatePeople(item, info.People ?? new List<PersonInfo>()).ConfigureAwait(false);
|
||||
if (info.People != null && info.People.Count > 0)
|
||||
{
|
||||
await _libraryManager.UpdatePeople(item, info.People ?? new List<PersonInfo>()).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
|
|
|
@ -39,58 +39,23 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ExternalImagePath))
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
if (liveTvItem.ExternalImagePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
try
|
||||
{
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ExternalImagePath,
|
||||
var response = await service.GetChannelImageAsync(liveTvItem.ExternalId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Some image hosts require a user agent to be specified.
|
||||
UserAgent = "Emby Server/" + _appHost.ApplicationVersion
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
if (response != null)
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
imageResponse.Stream = response.Stream;
|
||||
imageResponse.Format = response.Format;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await service.GetChannelImageAsync(liveTvItem.ExternalId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Stream;
|
||||
imageResponse.Format = response.Format;
|
||||
}
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -577,7 +577,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
// replaceImages.Add(ImageType.Primary);
|
||||
//}
|
||||
|
||||
item.ExternalImagePath = string.IsNullOrWhiteSpace(channelInfo.ImageUrl) ? channelInfo.ImagePath : channelInfo.ImageUrl;
|
||||
if (!string.IsNullOrWhiteSpace(channelInfo.ImagePath))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, channelInfo.ImagePath);
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(channelInfo.ImageUrl))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, channelInfo.ImageUrl);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.Name))
|
||||
{
|
||||
|
@ -636,7 +643,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
item.Name = info.Name;
|
||||
item.OfficialRating = item.OfficialRating ?? info.OfficialRating;
|
||||
item.Overview = item.Overview ?? info.Overview;
|
||||
item.ExternalImagePath = string.IsNullOrWhiteSpace(info.ImagePath) ? info.ImageUrl : info.ImagePath;
|
||||
item.RunTimeTicks = (info.EndDate - info.StartDate).Ticks;
|
||||
item.StartDate = info.StartDate;
|
||||
item.HomePageUrl = info.HomePageUrl;
|
||||
|
@ -647,6 +653,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
item.IndexNumber = info.EpisodeNumber;
|
||||
item.ParentIndexNumber = info.SeasonNumber;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(info.ImagePath))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, info.ImagePath);
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(info.ImageUrl))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, info.ImageUrl);
|
||||
}
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
|
@ -722,7 +737,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
recording.Audio = info.Audio;
|
||||
recording.EndDate = info.EndDate;
|
||||
recording.EpisodeTitle = info.EpisodeTitle;
|
||||
recording.ExternalImagePath = string.IsNullOrWhiteSpace(info.ImagePath) ? info.ImageUrl : info.ImagePath;
|
||||
recording.IsHD = info.IsHD;
|
||||
recording.IsKids = info.IsKids;
|
||||
recording.IsLive = info.IsLive;
|
||||
|
@ -735,6 +749,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
recording.SeriesTimerId = info.SeriesTimerId;
|
||||
recording.StartDate = info.StartDate;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(info.ImagePath))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, info.ImagePath);
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(info.ImageUrl))
|
||||
{
|
||||
item.SetImagePath(ImageType.Primary, info.ImageUrl);
|
||||
}
|
||||
|
||||
var statusChanged = info.Status != recording.Status;
|
||||
|
||||
recording.Status = info.Status;
|
||||
|
@ -1830,7 +1853,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
OriginalAirDate = program.PremiereDate,
|
||||
Overview = program.Overview,
|
||||
StartDate = program.StartDate,
|
||||
ImagePath = program.ExternalImagePath,
|
||||
//ImagePath = program.ExternalImagePath,
|
||||
Name = program.Name,
|
||||
OfficialRating = program.OfficialRating
|
||||
};
|
||||
|
|
|
@ -1,29 +1,22 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
{
|
||||
public class ProgramImageProvider : IDynamicImageProvider, IHasItemChangeMonitor, IHasOrder
|
||||
{
|
||||
private readonly ILiveTvManager _liveTvManager;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ProgramImageProvider(ILiveTvManager liveTvManager, IHttpClient httpClient, ILogger logger)
|
||||
public ProgramImageProvider(ILiveTvManager liveTvManager)
|
||||
{
|
||||
_liveTvManager = liveTvManager;
|
||||
_httpClient = httpClient;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
||||
|
@ -37,43 +30,26 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ExternalImagePath))
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
if (liveTvItem.ExternalImagePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
try
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.Protocol = MediaProtocol.Http;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId);
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId);
|
||||
|
||||
var response = await service.GetProgramImageAsync(liveTvItem.ExternalId, channel.ExternalId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Stream;
|
||||
imageResponse.Format = response.Format;
|
||||
}
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
var response = await service.GetProgramImageAsync(liveTvItem.ExternalId, channel.ExternalId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Stream;
|
||||
imageResponse.Format = response.Format;
|
||||
}
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return imageResponse;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -15,14 +13,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
public class RecordingImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
||||
{
|
||||
private readonly ILiveTvManager _liveTvManager;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public RecordingImageProvider(ILiveTvManager liveTvManager, IHttpClient httpClient, ILogger logger)
|
||||
public RecordingImageProvider(ILiveTvManager liveTvManager)
|
||||
{
|
||||
_liveTvManager = liveTvManager;
|
||||
_httpClient = httpClient;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
|
||||
|
@ -36,55 +30,23 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ExternalImagePath))
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
if (liveTvItem.ExternalImagePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
try
|
||||
{
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ExternalImagePath
|
||||
};
|
||||
var response = await service.GetRecordingImageAsync(liveTvItem.ExternalId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
if (response != null)
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
imageResponse.Stream = response.Stream;
|
||||
imageResponse.Format = response.Format;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (service != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await service.GetRecordingImageAsync(liveTvItem.ExternalId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Stream;
|
||||
imageResponse.Format = response.Format;
|
||||
}
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@
|
|||
<Compile Include="Channels\ChannelConfigurations.cs" />
|
||||
<Compile Include="Channels\ChannelDynamicMediaSourceProvider.cs" />
|
||||
<Compile Include="Channels\ChannelImageProvider.cs" />
|
||||
<Compile Include="Channels\ChannelItemImageProvider.cs" />
|
||||
<Compile Include="Channels\ChannelManager.cs" />
|
||||
<Compile Include="Channels\ChannelPostScanTask.cs" />
|
||||
<Compile Include="Channels\RefreshChannelsScheduledTask.cs" />
|
||||
|
|
|
@ -196,7 +196,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsHD", "BIT");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalEtag", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalImagePath", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
|
||||
|
||||
PrepareStatements();
|
||||
|
@ -290,7 +289,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"PreferredMetadataCountryCode",
|
||||
"IsHD",
|
||||
"ExternalEtag",
|
||||
"ExternalImagePath",
|
||||
"DateLastRefreshed"
|
||||
};
|
||||
|
||||
|
@ -378,7 +376,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"PreferredMetadataCountryCode",
|
||||
"IsHD",
|
||||
"ExternalEtag",
|
||||
"ExternalImagePath",
|
||||
"DateLastRefreshed"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
|
@ -598,7 +595,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_saveItemCommand.GetParameter(index++).Value = item.PreferredMetadataCountryCode;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.IsHD;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ExternalEtag;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ExternalImagePath;
|
||||
|
||||
if (item.DateLastRefreshed == default(DateTime))
|
||||
{
|
||||
|
@ -827,12 +823,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
if (!reader.IsDBNull(23))
|
||||
{
|
||||
item.ExternalImagePath = reader.GetString(23);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(24))
|
||||
{
|
||||
item.DateLastRefreshed = reader.GetDateTime(24).ToUniversalTime();
|
||||
item.DateLastRefreshed = reader.GetDateTime(23).ToUniversalTime();
|
||||
}
|
||||
|
||||
return item;
|
||||
|
|
|
@ -330,11 +330,6 @@ namespace MediaBrowser.ServerApplication
|
|||
_logger.Info("Shutting down");
|
||||
|
||||
_appHost.Dispose();
|
||||
|
||||
if (!_isRunningAsService)
|
||||
{
|
||||
SetErrorMode(ErrorModes.SYSTEM_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user