aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ApiEntryPoint.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-06-28 15:35:30 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-06-28 15:35:30 -0400
commit608ebf4829e7e394170bb2dec8a33c83600e9c08 (patch)
treec8b37e92ca12f4ab50378a03b2a9ec20fbe57940 /MediaBrowser.Api/ApiEntryPoint.cs
parentb1dd6365da6a2212555946d95b5d698a8af1ea4c (diff)
update video player layout
Diffstat (limited to 'MediaBrowser.Api/ApiEntryPoint.cs')
-rw-r--r--MediaBrowser.Api/ApiEntryPoint.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 154966240..577554610 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -325,6 +325,35 @@ namespace MediaBrowser.Api
}
/// <summary>
+ /// Kills the transcoding jobs.
+ /// </summary>
+ /// <param name="deviceId">The device identifier.</param>
+ /// <param name="outputPath">The output path.</param>
+ /// <param name="deleteMode">The delete mode.</param>
+ /// <exception cref="System.ArgumentNullException">deviceId</exception>
+ internal void KillTranscodingJobs(string deviceId, string outputPath, FileDeleteMode deleteMode)
+ {
+ if (string.IsNullOrEmpty(deviceId))
+ {
+ throw new ArgumentNullException("deviceId");
+ }
+
+ var jobs = new List<TranscodingJob>();
+
+ lock (_activeTranscodingJobs)
+ {
+ // This is really only needed for HLS.
+ // Progressive streams can stop on their own reliably
+ jobs.AddRange(_activeTranscodingJobs.Where(i => string.Equals(deviceId, i.DeviceId, StringComparison.OrdinalIgnoreCase) && string.Equals(outputPath, i.Path, StringComparison.OrdinalIgnoreCase)));
+ }
+
+ foreach (var job in jobs)
+ {
+ KillTranscodingJob(job, deleteMode);
+ }
+ }
+
+ /// <summary>
/// Kills the transcoding job.
/// </summary>
/// <param name="job">The job.</param>
@@ -443,6 +472,8 @@ namespace MediaBrowser.Api
.Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1)
.ToList();
+ Exception e = null;
+
foreach (var file in filesToDelete)
{
try
@@ -452,9 +483,15 @@ namespace MediaBrowser.Api
}
catch (IOException ex)
{
+ e = ex;
Logger.ErrorException("Error deleting HLS file {0}", ex, file);
}
}
+
+ if (e != null)
+ {
+ throw e;
+ }
}
}