mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 10:58:44 +01:00
More cleanup
This commit is contained in:
committed by
Cody Robibero (Rebase PR Action)
parent
4441513ca4
commit
ea8f40e84a
@@ -398,7 +398,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
}
|
||||
|
||||
result = new EpgChannelData(channels);
|
||||
_epgChannels.AddOrUpdate(info.Id, result, (k, v) => result);
|
||||
_epgChannels.AddOrUpdate(info.Id, result, (_, _) => result);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -1248,12 +1248,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
var remoteMetadata = await FetchInternetMetadata(timer, CancellationToken.None).ConfigureAwait(false);
|
||||
var recordPath = GetRecordingPath(timer, remoteMetadata, out string seriesPath);
|
||||
var recordingStatus = RecordingStatus.New;
|
||||
|
||||
string liveStreamId = null;
|
||||
|
||||
var channelItem = _liveTvManager.GetLiveTvChannel(timer, this);
|
||||
|
||||
string liveStreamId = null;
|
||||
RecordingStatus recordingStatus;
|
||||
try
|
||||
{
|
||||
var allMediaSources = await _mediaSourceManager.GetPlaybackMediaSources(channelItem, null, true, false, CancellationToken.None).ConfigureAwait(false);
|
||||
@@ -1339,7 +1338,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
TriggerRefresh(recordPath);
|
||||
_libraryMonitor.ReportFileSystemChangeComplete(recordPath, false);
|
||||
|
||||
_activeRecordings.TryRemove(timer.Id, out var removed);
|
||||
_activeRecordings.TryRemove(timer.Id, out _);
|
||||
|
||||
if (recordingStatus != RecordingStatus.Completed && DateTime.UtcNow < timer.EndDate && timer.RetryCount < 10)
|
||||
{
|
||||
@@ -1937,7 +1936,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
writer.WriteElementString("title", timer.EpisodeTitle);
|
||||
}
|
||||
|
||||
var premiereDate = item.PremiereDate ?? (!timer.IsRepeat ? DateTime.UtcNow : (DateTime?)null);
|
||||
var premiereDate = item.PremiereDate ?? (!timer.IsRepeat ? DateTime.UtcNow : null);
|
||||
|
||||
if (premiereDate.HasValue)
|
||||
{
|
||||
@@ -2126,12 +2125,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private LiveTvProgram GetProgramInfoFromCache(TimerInfo timer)
|
||||
{
|
||||
return GetProgramInfoFromCache(timer.ProgramId, timer.ChannelId);
|
||||
}
|
||||
|
||||
private LiveTvProgram GetProgramInfoFromCache(string programId, string channelId)
|
||||
{
|
||||
return GetProgramInfoFromCache(programId);
|
||||
return GetProgramInfoFromCache(timer.ProgramId);
|
||||
}
|
||||
|
||||
private LiveTvProgram GetProgramInfoFromCache(string channelId, DateTime startDateUtc)
|
||||
@@ -2277,7 +2271,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
// Only update if not currently active - test both new timer and existing in case Id's are different
|
||||
// Id's could be different if the timer was created manually prior to series timer creation
|
||||
if (!_activeRecordings.TryGetValue(timer.Id, out var activeRecordingInfo) && !_activeRecordings.TryGetValue(existingTimer.Id, out activeRecordingInfo))
|
||||
if (!_activeRecordings.TryGetValue(timer.Id, out _) && !_activeRecordings.TryGetValue(existingTimer.Id, out _))
|
||||
{
|
||||
UpdateExistingTimerWithNewMetadata(existingTimer, timer);
|
||||
|
||||
@@ -2298,17 +2292,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
enabledTimersForSeries.Add(existingTimer);
|
||||
}
|
||||
|
||||
if (updateTimerSettings)
|
||||
{
|
||||
existingTimer.KeepUntil = seriesTimer.KeepUntil;
|
||||
existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
|
||||
existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
|
||||
existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
|
||||
existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
|
||||
existingTimer.Priority = seriesTimer.Priority;
|
||||
}
|
||||
|
||||
existingTimer.KeepUntil = seriesTimer.KeepUntil;
|
||||
existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
|
||||
existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
|
||||
existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
|
||||
existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
|
||||
existingTimer.Priority = seriesTimer.Priority;
|
||||
existingTimer.SeriesTimerId = seriesTimer.Id;
|
||||
|
||||
_timerProvider.Update(existingTimer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
using var durationToken = new CancellationTokenSource(duration);
|
||||
using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, durationToken.Token);
|
||||
|
||||
await RecordFromFile(mediaSource, mediaSource.Path, targetFile, duration, onStarted, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
await RecordFromFile(mediaSource, mediaSource.Path, targetFile, onStarted, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
|
||||
_logger.LogInformation("Recording completed to file {0}", targetFile);
|
||||
}
|
||||
|
||||
private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
|
||||
private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, Action onStarted, CancellationToken cancellationToken)
|
||||
{
|
||||
_targetPath = targetFile;
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
|
||||
@@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
RedirectStandardInput = true,
|
||||
|
||||
FileName = _mediaEncoder.EncoderPath,
|
||||
Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile, duration),
|
||||
Arguments = GetCommandLineArgs(mediaSource, inputFile, targetFile),
|
||||
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
ErrorDialog = false
|
||||
@@ -103,7 +103,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
StartInfo = processStartInfo,
|
||||
EnableRaisingEvents = true
|
||||
};
|
||||
_process.Exited += (sender, args) => OnFfMpegProcessExited(_process);
|
||||
_process.Exited += (_, _) => OnFfMpegProcessExited(_process);
|
||||
|
||||
_process.Start();
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
_logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
|
||||
}
|
||||
|
||||
private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile, TimeSpan duration)
|
||||
private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile)
|
||||
{
|
||||
string videoArgs;
|
||||
if (EncodeVideo(mediaSource))
|
||||
|
||||
@@ -159,8 +159,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
var programEntry = programDict[schedule.ProgramId];
|
||||
|
||||
var allImages = images[imageIndex].Data;
|
||||
var imagesWithText = allImages.Where(i => string.Equals(i.Text, "yes", StringComparison.OrdinalIgnoreCase));
|
||||
var imagesWithoutText = allImages.Where(i => string.Equals(i.Text, "no", StringComparison.OrdinalIgnoreCase));
|
||||
var imagesWithText = allImages.Where(i => string.Equals(i.Text, "yes", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
var imagesWithoutText = allImages.Where(i => string.Equals(i.Text, "no", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
const double DesiredAspect = 2.0 / 3;
|
||||
|
||||
@@ -820,10 +820,5 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static string NormalizeName(string value)
|
||||
{
|
||||
return value.Replace(" ", string.Empty, StringComparison.Ordinal).Replace("-", string.Empty, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)
|
||||
if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
|
||||
{
|
||||
// HDHR4 doesn't have this api
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
if (!TryGetReturnValueOfGetSet(buffer.AsSpan(0, receivedBytes), out _))
|
||||
{
|
||||
await ReleaseLockkey(_tcpClient, lockKeyValue).ConfigureAwait(false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
public async Task Validate(TunerHostInfo info)
|
||||
{
|
||||
using (var stream = await new M3uParser(Logger, _httpClientFactory).GetListingsStream(info, CancellationToken.None).ConfigureAwait(false))
|
||||
using (await new M3uParser(Logger, _httpClientFactory).GetListingsStream(info, CancellationToken.None).ConfigureAwait(false))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user