mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-26 12:05:04 +01:00
update channel db
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user