|
|
|
@ -22,9 +22,9 @@ namespace ErsatzTV.Application.Channels; |
|
|
|
|
|
|
|
|
|
|
|
public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
private readonly IConfigElementRepository _configElementRepository; |
|
|
|
private readonly IDbContextFactory<TvContext> _dbContextFactory; |
|
|
|
private readonly IDbContextFactory<TvContext> _dbContextFactory; |
|
|
|
private readonly ILocalFileSystem _localFileSystem; |
|
|
|
private readonly ILocalFileSystem _localFileSystem; |
|
|
|
private readonly IConfigElementRepository _configElementRepository; |
|
|
|
|
|
|
|
private readonly ILogger<RefreshChannelDataHandler> _logger; |
|
|
|
private readonly ILogger<RefreshChannelDataHandler> _logger; |
|
|
|
private readonly RecyclableMemoryStreamManager _recyclableMemoryStreamManager; |
|
|
|
private readonly RecyclableMemoryStreamManager _recyclableMemoryStreamManager; |
|
|
|
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
public async Task Handle(RefreshChannelData request, CancellationToken cancellationToken) |
|
|
|
public async Task Handle(RefreshChannelData request, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_logger.LogDebug("Refreshing channel data (XMLTV) for channel {Channel}", request.ChannelNumber); |
|
|
|
_logger.LogDebug("Refreshing channel data (XMLTV) for channel {Channel}", request.ChannelNumber); |
|
|
|
|
|
|
|
|
|
|
|
_localFileSystem.EnsureFolderExists(FileSystemLayout.ChannelGuideCacheFolder); |
|
|
|
_localFileSystem.EnsureFolderExists(FileSystemLayout.ChannelGuideCacheFolder); |
|
|
|
|
|
|
|
|
|
|
|
string movieTemplateFileName = GetMovieTemplateFileName(); |
|
|
|
string movieTemplateFileName = GetMovieTemplateFileName(); |
|
|
|
@ -68,7 +68,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var templateContext = new XmlTemplateContext(); |
|
|
|
var templateContext = new XmlTemplateContext(); |
|
|
|
|
|
|
|
|
|
|
|
string movieText = await File.ReadAllTextAsync(movieTemplateFileName, cancellationToken); |
|
|
|
string movieText = await File.ReadAllTextAsync(movieTemplateFileName, cancellationToken); |
|
|
|
var movieTemplate = Template.Parse(movieText, movieTemplateFileName); |
|
|
|
var movieTemplate = Template.Parse(movieText, movieTemplateFileName); |
|
|
|
|
|
|
|
|
|
|
|
@ -302,7 +302,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
(_, true) => displayItem.GuideFinishOffset!.Value, |
|
|
|
(_, true) => displayItem.GuideFinishOffset!.Value, |
|
|
|
(_, false) => finishItem.FinishOffset |
|
|
|
(_, false) => finishItem.FinishOffset |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
string start = startTime |
|
|
|
string start = startTime |
|
|
|
.ToString("yyyyMMddHHmmss zzz", CultureInfo.InvariantCulture) |
|
|
|
.ToString("yyyyMMddHHmmss zzz", CultureInfo.InvariantCulture) |
|
|
|
.Replace(":", string.Empty); |
|
|
|
.Replace(":", string.Empty); |
|
|
|
@ -329,7 +329,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static async Task WriteBlockPlayoutXml( |
|
|
|
private static async Task WriteBlockPlayoutXml( |
|
|
|
RefreshChannelData request, |
|
|
|
RefreshChannelData request, |
|
|
|
List<PlayoutItem> sorted, |
|
|
|
List<PlayoutItem> sorted, |
|
|
|
@ -367,7 +367,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
item, |
|
|
|
item, |
|
|
|
start, |
|
|
|
start, |
|
|
|
stop, |
|
|
|
stop, |
|
|
|
hasCustomTitle: false, |
|
|
|
false, |
|
|
|
templateContext, |
|
|
|
templateContext, |
|
|
|
movieTemplate, |
|
|
|
movieTemplate, |
|
|
|
episodeTemplate, |
|
|
|
episodeTemplate, |
|
|
|
@ -481,7 +481,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
metadata.Genres ??= []; |
|
|
|
metadata.Genres ??= []; |
|
|
|
metadata.Guids ??= []; |
|
|
|
metadata.Guids ??= []; |
|
|
|
|
|
|
|
|
|
|
|
string poster = Optional(metadata.Artwork).Flatten() |
|
|
|
string poster = Optional(metadata.Artwork).Flatten() |
|
|
|
.Filter(a => a.ArtworkKind == ArtworkKind.Poster) |
|
|
|
.Filter(a => a.ArtworkKind == ArtworkKind.Poster) |
|
|
|
.HeadOrNone() |
|
|
|
.HeadOrNone() |
|
|
|
@ -491,9 +491,9 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ChannelNumber = request.ChannelNumber, |
|
|
|
request.ChannelNumber, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
CustomTitle = displayItem.CustomTitle, |
|
|
|
displayItem.CustomTitle, |
|
|
|
MovieTitle = title, |
|
|
|
MovieTitle = title, |
|
|
|
MovieHasPlot = !string.IsNullOrWhiteSpace(metadata.Plot), |
|
|
|
MovieHasPlot = !string.IsNullOrWhiteSpace(metadata.Plot), |
|
|
|
MoviePlot = metadata.Plot, |
|
|
|
MoviePlot = metadata.Plot, |
|
|
|
@ -516,7 +516,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return Option<string>.None; |
|
|
|
return Option<string>.None; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static async Task<Option<string>> ProcessEpisodeTemplate( |
|
|
|
private static async Task<Option<string>> ProcessEpisodeTemplate( |
|
|
|
RefreshChannelData request, |
|
|
|
RefreshChannelData request, |
|
|
|
Episode templateEpisode, |
|
|
|
Episode templateEpisode, |
|
|
|
@ -546,9 +546,9 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ChannelNumber = request.ChannelNumber, |
|
|
|
request.ChannelNumber, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
CustomTitle = displayItem.CustomTitle, |
|
|
|
displayItem.CustomTitle, |
|
|
|
ShowTitle = title, |
|
|
|
ShowTitle = title, |
|
|
|
EpisodeHasTitle = !string.IsNullOrWhiteSpace(subtitle), |
|
|
|
EpisodeHasTitle = !string.IsNullOrWhiteSpace(subtitle), |
|
|
|
EpisodeTitle = subtitle, |
|
|
|
EpisodeTitle = subtitle, |
|
|
|
@ -560,13 +560,13 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
EpisodeHasArtwork = !string.IsNullOrWhiteSpace(artworkPath), |
|
|
|
EpisodeHasArtwork = !string.IsNullOrWhiteSpace(artworkPath), |
|
|
|
EpisodeArtworkUrl = artworkPath, |
|
|
|
EpisodeArtworkUrl = artworkPath, |
|
|
|
SeasonNumber = templateEpisode.Season?.SeasonNumber ?? 0, |
|
|
|
SeasonNumber = templateEpisode.Season?.SeasonNumber ?? 0, |
|
|
|
EpisodeNumber = metadata.EpisodeNumber, |
|
|
|
metadata.EpisodeNumber, |
|
|
|
ShowHasContentRating = !string.IsNullOrWhiteSpace(showMetadata.ContentRating), |
|
|
|
ShowHasContentRating = !string.IsNullOrWhiteSpace(showMetadata.ContentRating), |
|
|
|
ShowContentRating = showMetadata.ContentRating, |
|
|
|
ShowContentRating = showMetadata.ContentRating, |
|
|
|
ShowGuids = showMetadata.Guids.Map(g => g.Guid), |
|
|
|
ShowGuids = showMetadata.Guids.Map(g => g.Guid), |
|
|
|
EpisodeGuids = metadata.Guids.Map(g => g.Guid) |
|
|
|
EpisodeGuids = metadata.Guids.Map(g => g.Guid) |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var scriptObject = new ScriptObject(); |
|
|
|
var scriptObject = new ScriptObject(); |
|
|
|
scriptObject.Import(data); |
|
|
|
scriptObject.Import(data); |
|
|
|
templateContext.PushGlobal(scriptObject); |
|
|
|
templateContext.PushGlobal(scriptObject); |
|
|
|
@ -606,9 +606,9 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ChannelNumber = request.ChannelNumber, |
|
|
|
request.ChannelNumber, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
CustomTitle = displayItem.CustomTitle, |
|
|
|
displayItem.CustomTitle, |
|
|
|
ArtistTitle = title, |
|
|
|
ArtistTitle = title, |
|
|
|
MusicVideoTitle = subtitle, |
|
|
|
MusicVideoTitle = subtitle, |
|
|
|
MusicVideoHasPlot = !string.IsNullOrWhiteSpace(metadata.Plot), |
|
|
|
MusicVideoHasPlot = !string.IsNullOrWhiteSpace(metadata.Plot), |
|
|
|
@ -639,7 +639,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return Option<string>.None; |
|
|
|
return Option<string>.None; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static async Task<Option<string>> ProcessSongTemplate( |
|
|
|
private static async Task<Option<string>> ProcessSongTemplate( |
|
|
|
RefreshChannelData request, |
|
|
|
RefreshChannelData request, |
|
|
|
Song templateSong, |
|
|
|
Song templateSong, |
|
|
|
@ -663,9 +663,9 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ChannelNumber = request.ChannelNumber, |
|
|
|
request.ChannelNumber, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
CustomTitle = displayItem.CustomTitle, |
|
|
|
displayItem.CustomTitle, |
|
|
|
SongTitle = subtitle, |
|
|
|
SongTitle = subtitle, |
|
|
|
SongArtists = metadata.Artists, |
|
|
|
SongArtists = metadata.Artists, |
|
|
|
SongAlbumArtists = metadata.AlbumArtists, |
|
|
|
SongAlbumArtists = metadata.AlbumArtists, |
|
|
|
@ -682,7 +682,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
SongAlbum = metadata.Album, |
|
|
|
SongAlbum = metadata.Album, |
|
|
|
SongHasReleaseDate = metadata.ReleaseDate.HasValue, |
|
|
|
SongHasReleaseDate = metadata.ReleaseDate.HasValue, |
|
|
|
SongReleaseDate = metadata.ReleaseDate, |
|
|
|
SongReleaseDate = metadata.ReleaseDate, |
|
|
|
SongStudios = metadata.Studios.Map(s => s.Name), |
|
|
|
SongStudios = metadata.Studios.Map(s => s.Name) |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var scriptObject = new ScriptObject(); |
|
|
|
var scriptObject = new ScriptObject(); |
|
|
|
@ -694,7 +694,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return Option<string>.None; |
|
|
|
return Option<string>.None; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static async Task<Option<string>> ProcessOtherVideoTemplate( |
|
|
|
private static async Task<Option<string>> ProcessOtherVideoTemplate( |
|
|
|
RefreshChannelData request, |
|
|
|
RefreshChannelData request, |
|
|
|
OtherVideo templateOtherVideo, |
|
|
|
OtherVideo templateOtherVideo, |
|
|
|
@ -710,14 +710,14 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
metadata.Genres ??= []; |
|
|
|
metadata.Genres ??= []; |
|
|
|
metadata.Guids ??= []; |
|
|
|
metadata.Guids ??= []; |
|
|
|
|
|
|
|
|
|
|
|
var data = new |
|
|
|
var data = new |
|
|
|
{ |
|
|
|
{ |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStart = start, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ProgrammeStop = stop, |
|
|
|
ChannelNumber = request.ChannelNumber, |
|
|
|
request.ChannelNumber, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
HasCustomTitle = hasCustomTitle, |
|
|
|
CustomTitle = displayItem.CustomTitle, |
|
|
|
displayItem.CustomTitle, |
|
|
|
OtherVideoTitle = title, |
|
|
|
OtherVideoTitle = title, |
|
|
|
OtherVideoHasPlot = !string.IsNullOrWhiteSpace(metadata.Plot), |
|
|
|
OtherVideoHasPlot = !string.IsNullOrWhiteSpace(metadata.Plot), |
|
|
|
OtherVideoPlot = metadata.Plot, |
|
|
|
OtherVideoPlot = metadata.Plot, |
|
|
|
@ -741,13 +741,13 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
private string GetMovieTemplateFileName() |
|
|
|
private string GetMovieTemplateFileName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "movie.sbntxt"); |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "movie.sbntxt"); |
|
|
|
|
|
|
|
|
|
|
|
// fall back to default template
|
|
|
|
// fall back to default template
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_movie.sbntxt"); |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_movie.sbntxt"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fail if file doesn't exist
|
|
|
|
// fail if file doesn't exist
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -760,17 +760,17 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return templateFileName; |
|
|
|
return templateFileName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string GetEpisodeTemplateFileName() |
|
|
|
private string GetEpisodeTemplateFileName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "episode.sbntxt"); |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "episode.sbntxt"); |
|
|
|
|
|
|
|
|
|
|
|
// fall back to default template
|
|
|
|
// fall back to default template
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_episode.sbntxt"); |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_episode.sbntxt"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fail if file doesn't exist
|
|
|
|
// fail if file doesn't exist
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -783,17 +783,17 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return templateFileName; |
|
|
|
return templateFileName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string GetMusicVideoTemplateFileName() |
|
|
|
private string GetMusicVideoTemplateFileName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "musicVideo.sbntxt"); |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "musicVideo.sbntxt"); |
|
|
|
|
|
|
|
|
|
|
|
// fall back to default template
|
|
|
|
// fall back to default template
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_musicVideo.sbntxt"); |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_musicVideo.sbntxt"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fail if file doesn't exist
|
|
|
|
// fail if file doesn't exist
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -806,17 +806,17 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return templateFileName; |
|
|
|
return templateFileName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string GetSongTemplateFileName() |
|
|
|
private string GetSongTemplateFileName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "song.sbntxt"); |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "song.sbntxt"); |
|
|
|
|
|
|
|
|
|
|
|
// fall back to default template
|
|
|
|
// fall back to default template
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_song.sbntxt"); |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_song.sbntxt"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fail if file doesn't exist
|
|
|
|
// fail if file doesn't exist
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -829,17 +829,17 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
|
|
|
|
|
|
|
|
return templateFileName; |
|
|
|
return templateFileName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string GetOtherVideoTemplateFileName() |
|
|
|
private string GetOtherVideoTemplateFileName() |
|
|
|
{ |
|
|
|
{ |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "otherVideo.sbntxt"); |
|
|
|
string templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "otherVideo.sbntxt"); |
|
|
|
|
|
|
|
|
|
|
|
// fall back to default template
|
|
|
|
// fall back to default template
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_otherVideo.sbntxt"); |
|
|
|
templateFileName = Path.Combine(FileSystemLayout.ChannelGuideTemplatesFolder, "_otherVideo.sbntxt"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fail if file doesn't exist
|
|
|
|
// fail if file doesn't exist
|
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
if (!_localFileSystem.FileExists(templateFileName)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -863,10 +863,12 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
_ => 440 |
|
|
|
_ => 440 |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (artworkPath.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || artworkPath.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) |
|
|
|
if (artworkPath.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || |
|
|
|
|
|
|
|
artworkPath.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return artworkPath; |
|
|
|
return artworkPath; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (artworkPath.StartsWith("jellyfin://", StringComparison.OrdinalIgnoreCase)) |
|
|
|
if (artworkPath.StartsWith("jellyfin://", StringComparison.OrdinalIgnoreCase)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
artworkPath = JellyfinUrl.PlaceholderProxyForArtwork(artworkPath, artworkKind, height); |
|
|
|
artworkPath = JellyfinUrl.PlaceholderProxyForArtwork(artworkPath, artworkKind, height); |
|
|
|
@ -1025,7 +1027,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
foreach (ExternalJsonChannel channel in maybeChannel) |
|
|
|
foreach (ExternalJsonChannel channel in maybeChannel) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: null start time should log and throw
|
|
|
|
// TODO: null start time should log and throw
|
|
|
|
|
|
|
|
|
|
|
|
DateTimeOffset startTime = DateTimeOffset.Parse( |
|
|
|
DateTimeOffset startTime = DateTimeOffset.Parse( |
|
|
|
channel.StartTime ?? string.Empty, |
|
|
|
channel.StartTime ?? string.Empty, |
|
|
|
CultureInfo.InvariantCulture, |
|
|
|
CultureInfo.InvariantCulture, |
|
|
|
@ -1077,14 +1079,15 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
var artwork = new List<Artwork>(); |
|
|
|
var artwork = new List<Artwork>(); |
|
|
|
if (!string.IsNullOrWhiteSpace(program.Icon)) |
|
|
|
if (!string.IsNullOrWhiteSpace(program.Icon)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
artwork.Add(new Artwork |
|
|
|
artwork.Add( |
|
|
|
{ |
|
|
|
new Artwork |
|
|
|
ArtworkKind = ArtworkKind.Thumbnail, |
|
|
|
{ |
|
|
|
Path = program.Icon, |
|
|
|
ArtworkKind = ArtworkKind.Thumbnail, |
|
|
|
SourcePath = program.Icon |
|
|
|
Path = program.Icon, |
|
|
|
}); |
|
|
|
SourcePath = program.Icon |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Episode |
|
|
|
return new Episode |
|
|
|
{ |
|
|
|
{ |
|
|
|
MediaVersions = |
|
|
|
MediaVersions = |
|
|
|
@ -1100,7 +1103,7 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
{ |
|
|
|
{ |
|
|
|
EpisodeNumber = program.Episode, |
|
|
|
EpisodeNumber = program.Episode, |
|
|
|
Title = program.Title |
|
|
|
Title = program.Title |
|
|
|
}, |
|
|
|
} |
|
|
|
], |
|
|
|
], |
|
|
|
Season = new Season |
|
|
|
Season = new Season |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -1125,12 +1128,13 @@ public class RefreshChannelDataHandler : IRequestHandler<RefreshChannelData> |
|
|
|
var artwork = new List<Artwork>(); |
|
|
|
var artwork = new List<Artwork>(); |
|
|
|
if (!string.IsNullOrWhiteSpace(program.Icon)) |
|
|
|
if (!string.IsNullOrWhiteSpace(program.Icon)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
artwork.Add(new Artwork |
|
|
|
artwork.Add( |
|
|
|
{ |
|
|
|
new Artwork |
|
|
|
ArtworkKind = ArtworkKind.Poster, |
|
|
|
{ |
|
|
|
Path = program.Icon, |
|
|
|
ArtworkKind = ArtworkKind.Poster, |
|
|
|
SourcePath = program.Icon |
|
|
|
Path = program.Icon, |
|
|
|
}); |
|
|
|
SourcePath = program.Icon |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Movie |
|
|
|
return new Movie |
|
|
|
|