update channel db
This commit is contained in:
parent
cf87301f45
commit
5c613f2dda
|
@ -7,24 +7,15 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Users;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public class ChannelAudioItem : Audio, IChannelMediaItem
|
||||
{
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
public string DataVersion { get; set; }
|
||||
|
||||
public ChannelItemType ChannelItemType { get; set; }
|
||||
|
||||
public bool IsInfiniteStream { get; set; }
|
||||
|
||||
public ChannelMediaContentType ContentType { get; set; }
|
||||
|
||||
public string OriginalImageUrl { get; set; }
|
||||
|
||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
|
@ -37,6 +28,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
return ExternalId;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
|
@ -55,6 +47,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
ChannelMediaSources = new List<ChannelMediaInfo>();
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override LocationType LocationType
|
||||
{
|
||||
get
|
||||
|
|
|
@ -3,18 +3,15 @@ using MediaBrowser.Model.Channels;
|
|||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public class ChannelFolderItem : Folder, IChannelItem
|
||||
{
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
public string DataVersion { get; set; }
|
||||
|
||||
public ChannelItemType ChannelItemType { get; set; }
|
||||
public ChannelFolderType ChannelFolderType { get; set; }
|
||||
|
||||
public string OriginalImageUrl { get; set; }
|
||||
|
@ -25,6 +22,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
return false;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
|
|
|
@ -8,24 +8,17 @@ using MediaBrowser.Model.Users;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public class ChannelVideoItem : Video, IChannelMediaItem, IHasLookupInfo<ChannelItemLookupInfo>
|
||||
{
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
public string DataVersion { get; set; }
|
||||
|
||||
public ChannelItemType ChannelItemType { get; set; }
|
||||
|
||||
public bool IsInfiniteStream { get; set; }
|
||||
|
||||
public ChannelMediaContentType ContentType { get; set; }
|
||||
|
||||
public string OriginalImageUrl { get; set; }
|
||||
|
||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||
|
||||
protected override string CreateUserDataKey()
|
||||
|
@ -56,6 +49,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent);
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
|
@ -74,6 +68,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
ChannelMediaSources = new List<ChannelMediaInfo>();
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override LocationType LocationType
|
||||
{
|
||||
get
|
||||
|
|
|
@ -8,10 +8,6 @@ namespace MediaBrowser.Controller.Channels
|
|||
|
||||
string ExternalId { get; set; }
|
||||
|
||||
ChannelItemType ChannelItemType { get; set; }
|
||||
|
||||
string OriginalImageUrl { get; set; }
|
||||
|
||||
string DataVersion { get; set; }
|
||||
string ExternalImagePath { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,6 +124,12 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <value>The id.</value>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is hd.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value>
|
||||
public bool? IsHD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the id that should be used to key display prefs for this item.
|
||||
/// Default is based on the type for everything except actual generic folders.
|
||||
|
@ -166,6 +172,33 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Id of the program.
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
public string ExternalId
|
||||
{
|
||||
get { return this.GetProviderId("ProviderExternalId"); }
|
||||
set
|
||||
{
|
||||
this.SetProviderId("ProviderExternalId", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <value>The etag.</value>
|
||||
[IgnoreDataMember]
|
||||
public string ExternalEtag { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public virtual bool IsHidden
|
||||
{
|
||||
|
|
|
@ -1397,7 +1397,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
var val = query.IsHD.Value;
|
||||
var video = item as Video;
|
||||
|
||||
if (video == null || val != video.IsHD)
|
||||
if (video == null || !video.IsHD.HasValue || val != video.IsHD)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -330,8 +330,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
get { return Video3DFormat.HasValue; }
|
||||
}
|
||||
|
||||
public bool IsHD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the media.
|
||||
/// </summary>
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public interface ILiveTvRecording : IHasImages, IHasMediaSources, IHasUserData, ILiveTvItem, IHasStartDate, IHasProgramAttributes
|
||||
{
|
||||
string ChannelId { get; }
|
||||
string ProgramId { get; set; }
|
||||
string MediaType { get; }
|
||||
|
||||
string Container { get; }
|
||||
|
@ -31,16 +30,11 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
|
||||
bool CanDelete(User user);
|
||||
|
||||
string ProviderImagePath { get; set; }
|
||||
string ExternalImagePath { get; set; }
|
||||
|
||||
string ProviderImageUrl { get; set; }
|
||||
|
||||
string ExternalId { get; set; }
|
||||
string EpisodeTitle { get; set; }
|
||||
string SeriesTimerId { get; set; }
|
||||
RecordingStatus Status { get; set; }
|
||||
DateTime? EndDate { get; set; }
|
||||
ChannelType ChannelType { get; set; }
|
||||
DateTime DateLastSaved { get; set; }
|
||||
DateTime DateCreated { get; set; }
|
||||
DateTime DateModified { get; set; }
|
||||
|
|
|
@ -14,9 +14,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
{
|
||||
public class LiveTvAudioRecording : Audio, ILiveTvRecording
|
||||
{
|
||||
public string ExternalId { get; set; }
|
||||
public string ProviderImagePath { get; set; }
|
||||
public string ProviderImageUrl { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public string EpisodeTitle { get; set; }
|
||||
[IgnoreDataMember]
|
||||
|
@ -35,13 +32,10 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public bool IsRepeat { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsMovie { get; set; }
|
||||
public bool? IsHD { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsLive { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsPremiere { get; set; }
|
||||
public ChannelType ChannelType { get; set; }
|
||||
public string ProgramId { get; set; }
|
||||
public ProgramAudio? Audio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -52,11 +46,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
{
|
||||
var name = GetClientTypeName();
|
||||
|
||||
if (!string.IsNullOrEmpty(ProgramId))
|
||||
{
|
||||
return name + "-" + ProgramId;
|
||||
}
|
||||
|
||||
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,12 +46,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <value>The number.</value>
|
||||
public string Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the external identifier.
|
||||
/// </summary>
|
||||
/// <value>The external identifier.</value>
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the channel.
|
||||
/// </summary>
|
||||
|
@ -64,24 +58,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <value>The name of the service.</value>
|
||||
public string ServiceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Supply the image path if it can be accessed directly from the file system
|
||||
/// </summary>
|
||||
/// <value>The image path.</value>
|
||||
public string ProviderImagePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Supply the image url if it can be downloaded
|
||||
/// </summary>
|
||||
/// <value>The image URL.</value>
|
||||
public string ProviderImageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has image.
|
||||
/// </summary>
|
||||
/// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value>
|
||||
public bool? HasProviderImage { get; set; }
|
||||
|
||||
public override LocationType LocationType
|
||||
{
|
||||
get
|
||||
|
|
|
@ -7,6 +7,7 @@ using MediaBrowser.Model.Users;
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
|
@ -30,17 +31,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
return GetClientTypeName() + "-" + Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the etag.
|
||||
/// </summary>
|
||||
/// <value>The etag.</value>
|
||||
public string Etag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of the program.
|
||||
/// </summary>
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the channel.
|
||||
/// </summary>
|
||||
|
@ -53,12 +43,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
[IgnoreDataMember]
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is hd.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value>
|
||||
public bool? IsHD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the audio.
|
||||
/// </summary>
|
||||
|
@ -85,24 +69,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <value>The name of the service.</value>
|
||||
public string ServiceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Supply the image path if it can be accessed directly from the file system
|
||||
/// </summary>
|
||||
/// <value>The image path.</value>
|
||||
public string ProviderImagePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Supply the image url if it can be downloaded
|
||||
/// </summary>
|
||||
/// <value>The image URL.</value>
|
||||
public string ProviderImageUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has image.
|
||||
/// </summary>
|
||||
/// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value>
|
||||
public bool? HasProviderImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is movie.
|
||||
/// </summary>
|
||||
|
|
|
@ -14,9 +14,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
{
|
||||
public class LiveTvVideoRecording : Video, ILiveTvRecording
|
||||
{
|
||||
public string ExternalId { get; set; }
|
||||
public string ProviderImagePath { get; set; }
|
||||
public string ProviderImageUrl { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public string EpisodeTitle { get; set; }
|
||||
[IgnoreDataMember]
|
||||
|
@ -35,13 +32,10 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
public bool IsRepeat { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsMovie { get; set; }
|
||||
public bool? IsHD { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsLive { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsPremiere { get; set; }
|
||||
public ChannelType ChannelType { get; set; }
|
||||
public string ProgramId { get; set; }
|
||||
public ProgramAudio? Audio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,11 +56,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
|
||||
var name = GetClientTypeName();
|
||||
|
||||
if (!string.IsNullOrEmpty(ProgramId))
|
||||
{
|
||||
return name + "-" + ProgramId;
|
||||
}
|
||||
|
||||
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
||||
}
|
||||
|
||||
|
@ -118,6 +107,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
return false;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
|
|
|
@ -926,10 +926,10 @@ namespace MediaBrowser.Providers.Manager
|
|||
return;
|
||||
}
|
||||
|
||||
var item = libraryManager.GetItemById(refreshItem.Item1);
|
||||
if (item != null)
|
||||
try
|
||||
{
|
||||
try
|
||||
var item = libraryManager.GetItemById(refreshItem.Item1);
|
||||
if (item != null)
|
||||
{
|
||||
// Try to throttle this a little bit.
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
|
@ -941,10 +941,10 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
await task.ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error refreshing item", ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error refreshing item", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(channelItem.OriginalImageUrl))
|
||||
if (!string.IsNullOrEmpty(channelItem.ExternalImagePath))
|
||||
{
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = channelItem.OriginalImageUrl
|
||||
Url = channelItem.ExternalImagePath
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
|
||||
if (channelItem != null)
|
||||
{
|
||||
return !channelItem.HasImage(ImageType.Primary) && !string.IsNullOrWhiteSpace(channelItem.OriginalImageUrl);
|
||||
return !channelItem.HasImage(ImageType.Primary) && !string.IsNullOrWhiteSpace(channelItem.ExternalImagePath);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1180,7 +1180,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
_logger.ErrorException("Error retrieving channel item from database", ex);
|
||||
}
|
||||
|
||||
if (item == null || !string.Equals(item.DataVersion, channnelDataVersion, StringComparison.Ordinal))
|
||||
if (item == null || !string.Equals(item.ExternalEtag, channnelDataVersion, StringComparison.Ordinal))
|
||||
{
|
||||
item = new T();
|
||||
isNew = true;
|
||||
|
@ -1190,7 +1190,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
isNew = false;
|
||||
}
|
||||
|
||||
item.DataVersion = channnelDataVersion;
|
||||
item.ExternalEtag = channnelDataVersion;
|
||||
item.Id = id;
|
||||
return item;
|
||||
}
|
||||
|
@ -1229,17 +1229,19 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
item.ProviderIds = info.ProviderIds;
|
||||
item.OfficialRating = info.OfficialRating;
|
||||
|
||||
item.DateCreated = info.DateCreated.HasValue ?
|
||||
info.DateCreated.Value :
|
||||
DateTime.UtcNow;
|
||||
item.DateCreated = info.DateCreated ?? DateTime.UtcNow;
|
||||
}
|
||||
|
||||
var channelItem = (IChannelItem)item;
|
||||
|
||||
channelItem.OriginalImageUrl = info.ImageUrl;
|
||||
channelItem.ExternalId = info.Id;
|
||||
channelItem.ExternalImagePath = info.ImageUrl;
|
||||
channelItem.ChannelId = internalChannelId.ToString("N");
|
||||
channelItem.ChannelItemType = info.Type;
|
||||
|
||||
if (!string.Equals(channelItem.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
isNew = true;
|
||||
}
|
||||
channelItem.ExternalId = info.Id;
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
|
|
|
@ -1042,6 +1042,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
dto.IsFolder = item.IsFolder;
|
||||
dto.MediaType = item.MediaType;
|
||||
dto.LocationType = item.LocationType;
|
||||
dto.IsHD = item.IsHD;
|
||||
|
||||
dto.PreferredMetadataCountryCode = item.PreferredMetadataCountryCode;
|
||||
dto.PreferredMetadataLanguage = item.PreferredMetadataLanguage;
|
||||
|
@ -1308,7 +1309,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
dto.VideoType = video.VideoType;
|
||||
dto.Video3DFormat = video.Video3DFormat;
|
||||
dto.IsoType = video.IsoType;
|
||||
dto.IsHD = video.IsHD;
|
||||
|
||||
if (video.AdditionalParts.Count != 0)
|
||||
{
|
||||
|
|
|
@ -39,38 +39,39 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ProviderImagePath))
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ExternalImagePath))
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ProviderImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(liveTvItem.ProviderImageUrl))
|
||||
{
|
||||
var options = new HttpRequestOptions
|
||||
if (liveTvItem.ExternalImagePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ProviderImageUrl,
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ExternalImagePath,
|
||||
|
||||
// Some image hosts require a user agent to be specified.
|
||||
UserAgent = "Emby Server/" + _appHost.ApplicationVersion
|
||||
};
|
||||
// Some image hosts require a user agent to be specified.
|
||||
UserAgent = "Emby Server/" + _appHost.ApplicationVersion
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
||||
var contentType = response.ContentType;
|
||||
|
||||
if (contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(contentType);
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
}
|
||||
else if (liveTvItem.HasProviderImage ?? true)
|
||||
else
|
||||
{
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
|
|
@ -572,9 +572,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
// replaceImages.Add(ImageType.Primary);
|
||||
//}
|
||||
|
||||
item.ProviderImageUrl = channelInfo.ImageUrl;
|
||||
item.HasProviderImage = channelInfo.HasImage;
|
||||
item.ProviderImagePath = channelInfo.ImagePath;
|
||||
item.ExternalImagePath = string.IsNullOrWhiteSpace(channelInfo.ImageUrl) ? channelInfo.ImagePath : channelInfo.ImageUrl;
|
||||
|
||||
if (string.IsNullOrEmpty(item.Name))
|
||||
{
|
||||
|
@ -607,7 +605,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
Id = id,
|
||||
DateCreated = DateTime.UtcNow,
|
||||
DateModified = DateTime.UtcNow,
|
||||
Etag = info.Etag
|
||||
ExternalEtag = info.Etag
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -621,7 +619,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
item.EpisodeTitle = info.EpisodeTitle;
|
||||
item.ExternalId = info.Id;
|
||||
item.Genres = info.Genres;
|
||||
item.HasProviderImage = info.HasImage;
|
||||
item.IsHD = info.IsHD;
|
||||
item.IsKids = info.IsKids;
|
||||
item.IsLive = info.IsLive;
|
||||
|
@ -634,8 +631,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
item.Name = info.Name;
|
||||
item.OfficialRating = item.OfficialRating ?? info.OfficialRating;
|
||||
item.Overview = item.Overview ?? info.Overview;
|
||||
item.ProviderImagePath = info.ImagePath;
|
||||
item.ProviderImageUrl = info.ImageUrl;
|
||||
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;
|
||||
|
@ -657,11 +653,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
else
|
||||
{
|
||||
// Increment this whenver some internal change deems it necessary
|
||||
var etag = info.Etag + "2";
|
||||
var etag = info.Etag + "4";
|
||||
|
||||
if (!string.Equals(etag, item.Etag, StringComparison.OrdinalIgnoreCase))
|
||||
if (!string.Equals(etag, item.ExternalEtag, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
item.Etag = etag;
|
||||
item.ExternalEtag = etag;
|
||||
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
@ -718,13 +714,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
recording.ExternalId = info.Id;
|
||||
|
||||
recording.ProgramId = _tvDtoService.GetInternalProgramId(serviceName, info.ProgramId).ToString("N");
|
||||
recording.Audio = info.Audio;
|
||||
recording.ChannelType = info.ChannelType;
|
||||
recording.EndDate = info.EndDate;
|
||||
recording.EpisodeTitle = info.EpisodeTitle;
|
||||
recording.ProviderImagePath = info.ImagePath;
|
||||
recording.ProviderImageUrl = info.ImageUrl;
|
||||
recording.ExternalImagePath = string.IsNullOrWhiteSpace(info.ImagePath) ? info.ImageUrl : info.ImagePath;
|
||||
recording.IsHD = info.IsHD;
|
||||
recording.IsKids = info.IsKids;
|
||||
recording.IsLive = info.IsLive;
|
||||
|
@ -1467,7 +1460,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
dto.RecordingStatus = info.Status;
|
||||
dto.IsRepeat = info.IsRepeat;
|
||||
dto.EpisodeTitle = info.EpisodeTitle;
|
||||
dto.ChannelType = info.ChannelType;
|
||||
dto.Audio = info.Audio;
|
||||
dto.IsHD = info.IsHD;
|
||||
dto.IsMovie = info.IsMovie;
|
||||
|
@ -1504,8 +1496,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
dto.CompletionPercentage = pct;
|
||||
}
|
||||
|
||||
dto.ProgramId = info.ProgramId;
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
dto.ChannelName = channel.Name;
|
||||
|
@ -1792,7 +1782,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
EndDate = program.EndDate ?? DateTime.MinValue,
|
||||
EpisodeTitle = program.EpisodeTitle,
|
||||
Genres = program.Genres,
|
||||
HasImage = program.HasProviderImage,
|
||||
Id = program.ExternalId,
|
||||
IsHD = program.IsHD,
|
||||
IsKids = program.IsKids,
|
||||
|
@ -1806,8 +1795,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
OriginalAirDate = program.PremiereDate,
|
||||
Overview = program.Overview,
|
||||
StartDate = program.StartDate,
|
||||
ImagePath = program.ProviderImagePath,
|
||||
ImageUrl = program.ProviderImageUrl,
|
||||
ImagePath = program.ExternalImagePath,
|
||||
Name = program.Name,
|
||||
OfficialRating = program.OfficialRating
|
||||
};
|
||||
|
|
|
@ -36,33 +36,36 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ProviderImagePath))
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ExternalImagePath))
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ProviderImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(liveTvItem.ProviderImageUrl))
|
||||
{
|
||||
var options = new HttpRequestOptions
|
||||
if (liveTvItem.ExternalImagePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ProviderImageUrl
|
||||
};
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ExternalImagePath
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
}
|
||||
else if (liveTvItem.HasProviderImage ?? true)
|
||||
else
|
||||
{
|
||||
var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
@ -115,7 +118,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (liveTvItem != null)
|
||||
{
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (liveTvItem.HasProviderImage ?? true);
|
||||
return !liveTvItem.HasImage(ImageType.Primary);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,30 +36,33 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
var imageResponse = new DynamicImageResponse();
|
||||
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ProviderImagePath))
|
||||
if (!string.IsNullOrEmpty(liveTvItem.ExternalImagePath))
|
||||
{
|
||||
imageResponse.Path = liveTvItem.ProviderImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(liveTvItem.ProviderImageUrl))
|
||||
{
|
||||
var options = new HttpRequestOptions
|
||||
if (liveTvItem.ExternalImagePath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ProviderImageUrl
|
||||
};
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
Url = liveTvItem.ExternalImagePath
|
||||
};
|
||||
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
var response = await _httpClient.GetResponse(options).ConfigureAwait(false);
|
||||
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
imageResponse.HasImage = true;
|
||||
imageResponse.Stream = response.Content;
|
||||
imageResponse.SetFormatFromMimeType(response.ContentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("Provider did not return an image content type.");
|
||||
imageResponse.Path = liveTvItem.ExternalImagePath;
|
||||
imageResponse.HasImage = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -109,7 +112,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||
|
||||
if (liveTvItem != null)
|
||||
{
|
||||
return !liveTvItem.HasImage(ImageType.Primary) && (!string.IsNullOrWhiteSpace(liveTvItem.ProviderImagePath) || !string.IsNullOrWhiteSpace(liveTvItem.ProviderImageUrl));
|
||||
return !liveTvItem.HasImage(ImageType.Primary);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
{
|
||||
return new ITaskTrigger[]
|
||||
{
|
||||
new IntervalTrigger{ Interval = TimeSpan.FromHours(6)}
|
||||
new IntervalTrigger{ Interval = TimeSpan.FromHours(24)}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ using System.Linq;
|
|||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Persistence
|
||||
{
|
||||
|
@ -72,7 +73,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private IDbCommand _deletePeopleCommand;
|
||||
private IDbCommand _savePersonCommand;
|
||||
|
||||
private const int LatestSchemaVersion = 11;
|
||||
private const int LatestSchemaVersion = 13;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
|
@ -187,7 +188,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
|
||||
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsHD", "BIT");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalEtag", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalImagePath", "Text");
|
||||
|
||||
PrepareStatements();
|
||||
|
||||
_mediaStreamsRepository.Initialize();
|
||||
|
@ -221,7 +225,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"IndexNumber",
|
||||
"IsLocked",
|
||||
"PreferredMetadataLanguage",
|
||||
"PreferredMetadataCountryCode"
|
||||
"PreferredMetadataCountryCode",
|
||||
"IsHD",
|
||||
"ExternalEtag",
|
||||
"ExternalImagePath"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -274,7 +281,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"IsOffline",
|
||||
"LocationType",
|
||||
"PreferredMetadataLanguage",
|
||||
"PreferredMetadataCountryCode"
|
||||
"PreferredMetadataCountryCode",
|
||||
"IsHD",
|
||||
"ExternalEtag",
|
||||
"ExternalImagePath"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
|
@ -460,7 +470,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.PreferredMetadataLanguage;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.PreferredMetadataCountryCode;
|
||||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.IsHD;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ExternalEtag;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ExternalImagePath;
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
|
||||
_saveItemCommand.ExecuteNonQuery();
|
||||
|
@ -667,6 +680,21 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
item.PreferredMetadataCountryCode = reader.GetString(20);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(21))
|
||||
{
|
||||
item.IsHD = reader.GetBoolean(21);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(22))
|
||||
{
|
||||
item.ExternalEtag = reader.GetString(22);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(23))
|
||||
{
|
||||
item.ExternalImagePath = reader.GetString(23);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -1394,7 +1422,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
typeof(UserRootFolder),
|
||||
typeof(UserView),
|
||||
typeof(Video),
|
||||
typeof(Year)
|
||||
typeof(Year),
|
||||
typeof(Channel)
|
||||
};
|
||||
|
||||
private static Dictionary<string, string[]> GetTypeMapDictionary()
|
||||
|
|
Loading…
Reference in New Issue
Block a user