aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ApiService.cs
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-10 11:17:52 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-10 11:17:52 -0400
commit92056c4d3d409590b23996eef2795419d4b9617b (patch)
treea86fe4b43f7da09c376d56f13512b4073afd6cb7 /MediaBrowser.Api/ApiService.cs
parent7303c6be3213891330da1dc44e87d44206dd653d (diff)
Added audio transcoding
Diffstat (limited to 'MediaBrowser.Api/ApiService.cs')
-rw-r--r--MediaBrowser.Api/ApiService.cs41
1 files changed, 39 insertions, 2 deletions
diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs
index 382d236ae..5945bf25a 100644
--- a/MediaBrowser.Api/ApiService.cs
+++ b/MediaBrowser.Api/ApiService.cs
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Runtime.Serialization;
+using MediaBrowser.Api.Transcoding;
using MediaBrowser.Controller;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Users;
namespace MediaBrowser.Api
{
@@ -13,6 +12,44 @@ namespace MediaBrowser.Api
/// </summary>
public static class ApiService
{
+ /// <summary>
+ /// Holds the list of active transcoding jobs
+ /// </summary>
+ private static List<TranscodingJob> CurrentTranscodingJobs = new List<TranscodingJob>();
+
+ /// <summary>
+ /// Finds an active transcoding job
+ /// </summary>
+ public static TranscodingJob GetTranscodingJob(string outputPath)
+ {
+ lock (CurrentTranscodingJobs)
+ {
+ return CurrentTranscodingJobs.FirstOrDefault(j => j.OutputFile.Equals(outputPath, StringComparison.OrdinalIgnoreCase));
+ }
+ }
+
+ /// <summary>
+ /// Removes a transcoding job from the active list
+ /// </summary>
+ public static void RemoveTranscodingJob(TranscodingJob job)
+ {
+ lock (CurrentTranscodingJobs)
+ {
+ CurrentTranscodingJobs.Remove(job);
+ }
+ }
+
+ /// <summary>
+ /// Adds a transcoding job to the active list
+ /// </summary>
+ public static void AddTranscodingJob(TranscodingJob job)
+ {
+ lock (CurrentTranscodingJobs)
+ {
+ CurrentTranscodingJobs.Add(job);
+ }
+ }
+
public static BaseItem GetItemById(string id)
{
Guid guid = string.IsNullOrEmpty(id) ? Guid.Empty : new Guid(id);