aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ApiEntryPoint.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2020-04-23 11:29:19 +0200
committerBond_009 <bond.009@outlook.com>2020-04-23 11:29:19 +0200
commit118f30059c11cf43d9780c8e0328423e35b44b76 (patch)
tree3dae865e35e3cd026e188706b5eec739cb33bf7b /MediaBrowser.Api/ApiEntryPoint.cs
parent10afa4509db6fc7e3c2e7dd6ccc8997dfe3b10f9 (diff)
parent97e383d108a4adb7e57c13d67f1d36bd1b5ce7b5 (diff)
Merge branch 'master' into nullable4
Diffstat (limited to 'MediaBrowser.Api/ApiEntryPoint.cs')
-rw-r--r--MediaBrowser.Api/ApiEntryPoint.cs29
1 files changed, 8 insertions, 21 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 4bd13df00..6691080bc 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -86,12 +86,9 @@ namespace MediaBrowser.Api
return Array.Empty<string>();
}
- if (removeEmpty)
- {
- return value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries);
- }
-
- return value.Split(separator);
+ return removeEmpty
+ ? value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries)
+ : value.Split(separator);
}
public SemaphoreSlim GetTranscodingLock(string outputPath)
@@ -258,7 +255,7 @@ namespace MediaBrowser.Api
public void ReportTranscodingProgress(TranscodingJob job, StreamState state, TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
{
- var ticks = transcodingPosition.HasValue ? transcodingPosition.Value.Ticks : (long?)null;
+ var ticks = transcodingPosition?.Ticks;
if (job != null)
{
@@ -487,16 +484,9 @@ namespace MediaBrowser.Api
/// <returns>Task.</returns>
internal Task KillTranscodingJobs(string deviceId, string playSessionId, Func<string, bool> deleteFiles)
{
- return KillTranscodingJobs(j =>
- {
- if (!string.IsNullOrWhiteSpace(playSessionId))
- {
- return string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase);
- }
-
- return string.Equals(deviceId, j.DeviceId, StringComparison.OrdinalIgnoreCase);
-
- }, deleteFiles);
+ return KillTranscodingJobs(j => string.IsNullOrWhiteSpace(playSessionId)
+ ? string.Equals(deviceId, j.DeviceId, StringComparison.OrdinalIgnoreCase)
+ : string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase), deleteFiles);
}
/// <summary>
@@ -561,10 +551,7 @@ namespace MediaBrowser.Api
lock (job.ProcessLock)
{
- if (job.TranscodingThrottler != null)
- {
- job.TranscodingThrottler.Stop().GetAwaiter().GetResult();
- }
+ job.TranscodingThrottler?.Stop().GetAwaiter().GetResult();
var process = job.Process;