fix clipboard and logs (#1466)

* fix copy to clipboard in some cases

* improve subtitle language selection logging

* log playout item details
This commit is contained in:
Jason Dove
2023-10-06 19:36:42 -05:00
committed by GitHub
parent b39dd693f0
commit 5291832e6c
4 changed files with 53 additions and 9 deletions
+3
View File
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **This mode does NOT detect black and intelligently crop**
- The goal is to fill the canvas by over-scaling and cropping, instead of minimally scaling and padding
- Include `inputstream.ffmpegdirect` properties in channels.m3u when requested by Kodi
- Log playout item title and path when starting a stream
- This will help with media server libraries where the URL passed to ffmpeg doesn't indicate which file is streaming
### Fixed
- Fix playout bug that caused some schedule items with fixed start times to be pushed to the next day
@@ -22,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Remove ffmpeg and ffprobe as required dependencies for scanning media server libraries
- Note that ffmpeg is still *always* required for playback to work
- Fix PGS subtitle pixel format with Intel VAAPI
- Fix some cases where `Copy` button would fail to copy to clipboard
### Changed
- Upgrade ffmpeg to 6.1, which is now *required* for all installs
@@ -1,5 +1,6 @@
using CliWrap;
using Dapper;
using ErsatzTV.Application.Playouts;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain.Filler;
@@ -83,6 +84,10 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
.ThenInclude(mi => (mi as Episode).MediaVersions)
.ThenInclude(mv => mv.Streams)
.Include(i => i.MediaItem)
.ThenInclude(mi => (mi as Episode).Season)
.ThenInclude(s => s.Show)
.ThenInclude(s => s.ShowMetadata)
.Include(i => i.MediaItem)
.ThenInclude(mi => (mi as Movie).MovieMetadata)
.ThenInclude(mm => mm.Subtitles)
.Include(i => i.MediaItem)
@@ -142,6 +147,22 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
foreach (PlayoutItemWithPath playoutItemWithPath in maybePlayoutItem.RightToSeq())
{
try
{
PlayoutItemViewModel viewModel = Mapper.ProjectToViewModel(playoutItemWithPath.PlayoutItem);
if (!string.IsNullOrWhiteSpace(viewModel.Title))
{
_logger.LogDebug(
"Found playout item {Title} with path {Path}",
viewModel.Title,
playoutItemWithPath.Path);
}
}
catch (Exception ex)
{
_logger.LogDebug(ex, "Failed to get playout item title");
}
MediaVersion version = playoutItemWithPath.PlayoutItem.MediaItem.GetHeadVersion();
string videoPath = playoutItemWithPath.Path;
+9 -4
View File
@@ -138,6 +138,7 @@ public class FFmpegStreamSelector : IFFmpegStreamSelector
return None;
}
var allCodes = new List<string>();
string language = (preferredSubtitleLanguage ?? string.Empty).ToLowerInvariant();
if (string.IsNullOrWhiteSpace(language))
{
@@ -146,10 +147,14 @@ public class FFmpegStreamSelector : IFFmpegStreamSelector
else
{
// filter to preferred language
List<string> allCodes = await _searchRepository.GetAllLanguageCodes(new List<string> { language });
allCodes = await _searchRepository.GetAllLanguageCodes(new List<string> { language });
if (allCodes.Count > 1)
{
_logger.LogDebug("Preferred subtitle language has multiple codes {Codes}", allCodes);
}
subtitles = subtitles
.Filter(
s => allCodes.Any(c => string.Equals(s.Language, c, StringComparison.OrdinalIgnoreCase)))
.Filter(s => allCodes.Any(c => string.Equals(s.Language, c, StringComparison.OrdinalIgnoreCase)))
.ToList();
}
@@ -185,7 +190,7 @@ public class FFmpegStreamSelector : IFFmpegStreamSelector
"Found no subtitles for channel {ChannelNumber} with mode {Mode} matching language {Language}",
channel.Number,
subtitleMode,
preferredSubtitleLanguage);
allCodes);
return None;
}
+20 -5
View File
@@ -79,11 +79,26 @@
};
window.clipboardCopy = {
copyText: function (codeElement) {
navigator.clipboard.writeText(codeElement.textContent)
.catch(function (error) {
console.log(error);
});
copyText: async function (codeElement) {
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(codeElement.textContent);
} else {
const textArea = document.createElement("textarea");
textArea.value = codeElement.textContent;
textArea.style.position = "absolute";
textArea.style.left = "-999999px";
document.body.prepend(textArea);
textArea.select();
try {
document.execCommand('copy');
} catch (error) {
console.error(error);
} finally {
textArea.remove();
}
}
}
};
</script>