commit
7b354c63d2
|
@ -11,6 +11,7 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Library
|
namespace MediaBrowser.Api.Library
|
||||||
|
@ -140,6 +141,14 @@ namespace MediaBrowser.Api.Library
|
||||||
public bool RefreshLibrary { get; set; }
|
public bool RefreshLibrary { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("/Library/VirtualFolders/LibraryOptions", "POST")]
|
||||||
|
public class UpdateLibraryOptions : IReturnVoid
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public LibraryOptions LibraryOptions { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class LibraryStructureService
|
/// Class LibraryStructureService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -188,6 +197,13 @@ namespace MediaBrowser.Api.Library
|
||||||
return ToOptimizedSerializedResultUsingCache(result);
|
return ToOptimizedSerializedResultUsingCache(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Post(UpdateLibraryOptions request)
|
||||||
|
{
|
||||||
|
var collectionFolder = (CollectionFolder)_libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
|
collectionFolder.UpdateLibraryOptions(request.LibraryOptions);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -220,12 +236,12 @@ namespace MediaBrowser.Api.Library
|
||||||
var currentPath = Path.Combine(rootFolderPath, request.Name);
|
var currentPath = Path.Combine(rootFolderPath, request.Name);
|
||||||
var newPath = Path.Combine(rootFolderPath, request.NewName);
|
var newPath = Path.Combine(rootFolderPath, request.NewName);
|
||||||
|
|
||||||
if (!_fileSystem.DirectoryExists(currentPath))
|
if (!_fileSystem.DirectoryExists(currentPath))
|
||||||
{
|
{
|
||||||
throw new DirectoryNotFoundException("The media collection does not exist");
|
throw new DirectoryNotFoundException("The media collection does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath))
|
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("There is already a media collection with the name " + newPath + ".");
|
throw new ArgumentException("There is already a media collection with the name " + newPath + ".");
|
||||||
}
|
}
|
||||||
|
@ -240,11 +256,11 @@ namespace MediaBrowser.Api.Library
|
||||||
//Create an unique name
|
//Create an unique name
|
||||||
var temporaryName = Guid.NewGuid().ToString();
|
var temporaryName = Guid.NewGuid().ToString();
|
||||||
var temporaryPath = Path.Combine(rootFolderPath, temporaryName);
|
var temporaryPath = Path.Combine(rootFolderPath, temporaryName);
|
||||||
_fileSystem.MoveDirectory(currentPath, temporaryPath);
|
_fileSystem.MoveDirectory(currentPath, temporaryPath);
|
||||||
currentPath = temporaryPath;
|
currentPath = temporaryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
_fileSystem.MoveDirectory(currentPath, newPath);
|
_fileSystem.MoveDirectory(currentPath, newPath);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -284,6 +284,13 @@ namespace MediaBrowser.Api.Playback
|
||||||
options.ForceDirectPlay = true;
|
options.ForceDirectPlay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (item is Video)
|
||||||
|
{
|
||||||
|
if (!user.Policy.EnableAudioPlaybackTranscoding && !user.Policy.EnableVideoPlaybackTranscoding && !user.Policy.EnablePlaybackRemuxing)
|
||||||
|
{
|
||||||
|
options.ForceDirectPlay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The MediaSource supports direct stream, now test to see if the client supports it
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
||||||
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
||||||
|
@ -315,6 +322,13 @@ namespace MediaBrowser.Api.Playback
|
||||||
options.ForceDirectStream = true;
|
options.ForceDirectStream = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (item is Video)
|
||||||
|
{
|
||||||
|
if (!user.Policy.EnableAudioPlaybackTranscoding && !user.Policy.EnableVideoPlaybackTranscoding && !user.Policy.EnablePlaybackRemuxing)
|
||||||
|
{
|
||||||
|
options.ForceDirectStream = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The MediaSource supports direct stream, now test to see if the client supports it
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
||||||
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
||||||
|
|
|
@ -95,9 +95,19 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return System.IO.Path.Combine(path, "options.xml");
|
return System.IO.Path.Combine(path, "options.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateLibraryOptions(LibraryOptions options)
|
||||||
|
{
|
||||||
|
SaveLibraryOptions(Path, options);
|
||||||
|
}
|
||||||
|
|
||||||
public static void SaveLibraryOptions(string path, LibraryOptions options)
|
public static void SaveLibraryOptions(string path, LibraryOptions options)
|
||||||
{
|
{
|
||||||
XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
|
lock (LibraryOptions)
|
||||||
|
{
|
||||||
|
LibraryOptions[path] = options;
|
||||||
|
|
||||||
|
XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -110,8 +110,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO
|
return !FileSystem.ContainsSubPath(ConfigurationManager.ApplicationPaths.DataPath, Path);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Model.Extensions;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Dlna
|
namespace MediaBrowser.Model.Dlna
|
||||||
{
|
{
|
||||||
|
@ -59,8 +60,8 @@ namespace MediaBrowser.Model.Dlna
|
||||||
|
|
||||||
private static double GetVideoBitrateScaleFactor(string codec)
|
private static double GetVideoBitrateScaleFactor(string codec)
|
||||||
{
|
{
|
||||||
if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase) ||
|
if (StringHelper.EqualsIgnoreCase(codec, "h265") ||
|
||||||
string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase))
|
StringHelper.EqualsIgnoreCase(codec, "hevc"))
|
||||||
{
|
{
|
||||||
return .5;
|
return .5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace MediaBrowser.Model.Users
|
||||||
public bool EnableMediaPlayback { get; set; }
|
public bool EnableMediaPlayback { get; set; }
|
||||||
public bool EnableAudioPlaybackTranscoding { get; set; }
|
public bool EnableAudioPlaybackTranscoding { get; set; }
|
||||||
public bool EnableVideoPlaybackTranscoding { get; set; }
|
public bool EnableVideoPlaybackTranscoding { get; set; }
|
||||||
|
public bool EnablePlaybackRemuxing { get; set; }
|
||||||
|
|
||||||
public bool EnableContentDeletion { get; set; }
|
public bool EnableContentDeletion { get; set; }
|
||||||
public bool EnableContentDownloading { get; set; }
|
public bool EnableContentDownloading { get; set; }
|
||||||
|
@ -76,6 +77,7 @@ namespace MediaBrowser.Model.Users
|
||||||
EnableMediaPlayback = true;
|
EnableMediaPlayback = true;
|
||||||
EnableAudioPlaybackTranscoding = true;
|
EnableAudioPlaybackTranscoding = true;
|
||||||
EnableVideoPlaybackTranscoding = true;
|
EnableVideoPlaybackTranscoding = true;
|
||||||
|
EnablePlaybackRemuxing = true;
|
||||||
|
|
||||||
EnableLiveTvManagement = true;
|
EnableLiveTvManagement = true;
|
||||||
EnableLiveTvAccess = true;
|
EnableLiveTvAccess = true;
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||||
public class CollectionsDynamicFolder : IVirtualFolderCreator
|
public class CollectionsDynamicFolder : IVirtualFolderCreator
|
||||||
{
|
{
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
private IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
|
||||||
public CollectionsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
|
public CollectionsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
|
|
|
@ -534,7 +534,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
||||||
if (lastDateModified.HasValue && (string.IsNullOrEmpty(cacheKey) || cacheDuration.HasValue))
|
if (lastDateModified.HasValue && (string.IsNullOrEmpty(cacheKey) || cacheDuration.HasValue))
|
||||||
{
|
{
|
||||||
AddAgeHeader(responseHeaders, lastDateModified);
|
AddAgeHeader(responseHeaders, lastDateModified);
|
||||||
responseHeaders["LastModified"] = lastDateModified.Value.ToString("r");
|
responseHeaders["Last-Modified"] = lastDateModified.Value.ToString("r");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheDuration.HasValue)
|
if (cacheDuration.HasValue)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user