diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 62fcbd280e..8febe4a65d 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -1,13 +1,13 @@
-using System.IO;
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging;
+using ServiceStack.Web;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
-using ServiceStack.Web;
namespace MediaBrowser.Api
{
@@ -52,11 +52,6 @@ namespace MediaBrowser.Api
return ResultFactory.GetOptimizedResult(Request, result);
}
- protected object ToStreamResult(Stream stream, string contentType)
- {
- return ResultFactory.GetResult(stream, contentType);
- }
-
///
/// To the optimized result using cache.
///
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs
index e40cb7dd46..3836a08602 100644
--- a/MediaBrowser.Api/Library/LibraryHelpers.cs
+++ b/MediaBrowser.Api/Library/LibraryHelpers.cs
@@ -68,8 +68,6 @@ namespace MediaBrowser.Api.Library
var rootFolderPath = user != null ? user.RootFolderPath : appPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
- ValidateNewMediaPath(fileSystem, rootFolderPath, path);
-
var shortcutFilename = Path.GetFileNameWithoutExtension(path);
var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
@@ -82,73 +80,5 @@ namespace MediaBrowser.Api.Library
fileSystem.CreateShortcut(lnk, path);
}
-
- ///
- /// Validates that a new media path can be added
- ///
- /// The file system.
- /// The current view root folder path.
- /// The media path.
- ///
- ///
- private static void ValidateNewMediaPath(IFileSystem fileSystem, string currentViewRootFolderPath, string mediaPath)
- {
- var pathsInCurrentVIew = Directory.EnumerateFiles(currentViewRootFolderPath, ShortcutFileSearch, SearchOption.AllDirectories)
- .Select(fileSystem.ResolveShortcut)
- .ToList();
-
- // Don't allow duplicate sub-paths within the same user library, or it will result in duplicate items
- // See comments in IsNewPathValid
- var duplicate = pathsInCurrentVIew
- .FirstOrDefault(p => !IsNewPathValid(fileSystem, mediaPath, p));
-
- if (!string.IsNullOrEmpty(duplicate))
- {
- throw new ArgumentException(string.Format("The path cannot be added to the library because {0} already exists.", duplicate));
- }
-
- // Make sure the current root folder doesn't already have a shortcut to the same path
- duplicate = pathsInCurrentVIew
- .FirstOrDefault(p => string.Equals(mediaPath, p, StringComparison.OrdinalIgnoreCase));
-
- if (!string.IsNullOrEmpty(duplicate))
- {
- throw new ArgumentException(string.Format("The path {0} already exists in the library", mediaPath));
- }
- }
-
- ///
- /// Validates that a new path can be added based on an existing path
- ///
- /// The file system.
- /// The new path.
- /// The existing path.
- /// true if [is new path valid] [the specified new path]; otherwise, false.
- private static bool IsNewPathValid(IFileSystem fileSystem, string newPath, string existingPath)
- {
- // Example: D:\Movies is the existing path
- // D:\ cannot be added
- // Neither can D:\Movies\Kids
- // A D:\Movies duplicate is ok here since that will be caught later
-
- if (string.Equals(newPath, existingPath, StringComparison.OrdinalIgnoreCase))
- {
- return true;
- }
-
- // If enforceSubPathRestriction is true, validate the D:\Movies\Kids scenario
- if (fileSystem.ContainsSubPath(existingPath, newPath))
- {
- return false;
- }
-
- // Validate the D:\ scenario
- if (fileSystem.ContainsSubPath(newPath, existingPath))
- {
- return false;
- }
-
- return true;
- }
}
}
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 59fac57261..98d6e97a44 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1042,6 +1042,7 @@ namespace MediaBrowser.Api.Playback
}
itemId = recording.Id;
+ //state.RunTimeTicks = recording.RunTimeTicks;
state.SendInputOverStandardInput = recording.RecordingInfo.Status == RecordingStatus.InProgress;
}
else if (string.Equals(request.Type, "Channel", StringComparison.OrdinalIgnoreCase))
@@ -1090,6 +1091,7 @@ namespace MediaBrowser.Api.Playback
: video.PlayableStreamFileNames.ToList();
}
+ state.RunTimeTicks = item.RunTimeTicks;
itemId = item.Id;
}
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 1c43269282..f244886dc4 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -75,18 +75,23 @@ namespace MediaBrowser.Api.Playback.Hls
/// System.Object.
protected object ProcessRequest(StreamRequest request)
{
- var state = GetState(request, CancellationToken.None).Result;
-
- return ProcessRequestAsync(state).Result;
+ return ProcessRequestAsync(request).Result;
}
///
/// Processes the request async.
///
- /// The state.
+ /// The request.
/// Task{System.Object}.
- public async Task