mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-30 11:22:53 +01:00
Merge branch 'master' into culture
This commit is contained in:
@@ -646,7 +646,7 @@ namespace MediaBrowser.Api
|
||||
/// <param name="outputFilePath">The output file path.</param>
|
||||
private void DeleteHlsPartialStreamFiles(string outputFilePath)
|
||||
{
|
||||
var directory = _fileSystem.GetDirectoryName(outputFilePath);
|
||||
var directory = Path.GetDirectoryName(outputFilePath);
|
||||
var name = Path.GetFileNameWithoutExtension(outputFilePath);
|
||||
|
||||
var filesToDelete = _fileSystem.GetFilePaths(directory)
|
||||
|
||||
@@ -137,14 +137,14 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
if (request.IsFile.Value)
|
||||
{
|
||||
if (!_fileSystem.FileExists(request.Path))
|
||||
if (!File.Exists(request.Path))
|
||||
{
|
||||
throw new FileNotFoundException("File not found", request.Path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_fileSystem.DirectoryExists(request.Path))
|
||||
if (!Directory.Exists(request.Path))
|
||||
{
|
||||
throw new FileNotFoundException("File not found", request.Path);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace MediaBrowser.Api
|
||||
|
||||
else
|
||||
{
|
||||
if (!_fileSystem.FileExists(request.Path) && !_fileSystem.DirectoryExists(request.Path))
|
||||
if (!File.Exists(request.Path) && !Directory.Exists(request.Path))
|
||||
{
|
||||
throw new FileNotFoundException("Path not found", request.Path);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
var file = Path.Combine(path, Guid.NewGuid().ToString());
|
||||
|
||||
_fileSystem.WriteAllText(file, string.Empty);
|
||||
File.WriteAllText(file, string.Empty);
|
||||
_fileSystem.DeleteFile(file);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace MediaBrowser.Api
|
||||
|
||||
public object Get(GetParentPath request)
|
||||
{
|
||||
var parent = _fileSystem.GetDirectoryName(request.Path);
|
||||
var parent = Path.GetDirectoryName(request.Path);
|
||||
|
||||
if (string.IsNullOrEmpty(parent))
|
||||
{
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace MediaBrowser.Api.Images
|
||||
|
||||
private string GetThemeName(string path, string rootImagePath)
|
||||
{
|
||||
var parentName = _fileSystem.GetDirectoryName(path);
|
||||
var parentName = Path.GetDirectoryName(path);
|
||||
|
||||
if (string.Equals(parentName, rootImagePath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Images
|
||||
|
||||
var paths = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(_appPaths.GeneralPath, request.Name, filename + i)).ToList();
|
||||
|
||||
var path = paths.FirstOrDefault(_fileSystem.FileExists) ?? paths.FirstOrDefault();
|
||||
var path = paths.FirstOrDefault(File.Exists) ?? paths.FirstOrDefault();
|
||||
|
||||
return _resultFactory.GetStaticFileResult(Request, path);
|
||||
}
|
||||
@@ -199,11 +199,11 @@ namespace MediaBrowser.Api.Images
|
||||
{
|
||||
var themeFolder = Path.Combine(_appPaths.RatingsPath, request.Theme);
|
||||
|
||||
if (_fileSystem.DirectoryExists(themeFolder))
|
||||
if (Directory.Exists(themeFolder))
|
||||
{
|
||||
var path = BaseItem.SupportedImageExtensions
|
||||
.Select(i => Path.Combine(themeFolder, request.Name + i))
|
||||
.FirstOrDefault(_fileSystem.FileExists);
|
||||
.FirstOrDefault(File.Exists);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
@@ -213,14 +213,14 @@ namespace MediaBrowser.Api.Images
|
||||
|
||||
var allFolder = Path.Combine(_appPaths.RatingsPath, "all");
|
||||
|
||||
if (_fileSystem.DirectoryExists(allFolder))
|
||||
if (Directory.Exists(allFolder))
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var currentRequest = request;
|
||||
|
||||
var path = BaseItem.SupportedImageExtensions
|
||||
.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
|
||||
.FirstOrDefault(_fileSystem.FileExists);
|
||||
.FirstOrDefault(File.Exists);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
@@ -240,10 +240,10 @@ namespace MediaBrowser.Api.Images
|
||||
{
|
||||
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);
|
||||
|
||||
if (_fileSystem.DirectoryExists(themeFolder))
|
||||
if (Directory.Exists(themeFolder))
|
||||
{
|
||||
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i))
|
||||
.FirstOrDefault(_fileSystem.FileExists);
|
||||
.FirstOrDefault(File.Exists);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
@@ -253,13 +253,13 @@ namespace MediaBrowser.Api.Images
|
||||
|
||||
var allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all");
|
||||
|
||||
if (_fileSystem.DirectoryExists(allFolder))
|
||||
if (Directory.Exists(allFolder))
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var currentRequest = request;
|
||||
|
||||
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
|
||||
.FirstOrDefault(_fileSystem.FileExists);
|
||||
.FirstOrDefault(File.Exists);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
|
||||
@@ -220,9 +220,9 @@ namespace MediaBrowser.Api.Images
|
||||
|
||||
try
|
||||
{
|
||||
contentPath = _fileSystem.ReadAllText(pointerCachePath);
|
||||
contentPath = File.ReadAllText(pointerCachePath);
|
||||
|
||||
if (_fileSystem.FileExists(contentPath))
|
||||
if (File.Exists(contentPath))
|
||||
{
|
||||
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ namespace MediaBrowser.Api.Images
|
||||
await DownloadImage(request.ImageUrl, urlHash, pointerCachePath).ConfigureAwait(false);
|
||||
|
||||
// Read the pointer file again
|
||||
contentPath = _fileSystem.ReadAllText(pointerCachePath);
|
||||
contentPath = File.ReadAllText(pointerCachePath);
|
||||
|
||||
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Images
|
||||
|
||||
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
|
||||
|
||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
|
||||
using (var stream = result.Content)
|
||||
{
|
||||
using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
|
||||
@@ -273,8 +273,8 @@ namespace MediaBrowser.Api.Images
|
||||
}
|
||||
}
|
||||
|
||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath));
|
||||
_fileSystem.WriteAllText(pointerCachePath, fullCachePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
|
||||
File.WriteAllText(pointerCachePath, fullCachePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -265,9 +265,9 @@ namespace MediaBrowser.Api
|
||||
|
||||
try
|
||||
{
|
||||
contentPath = _fileSystem.ReadAllText(pointerCachePath);
|
||||
contentPath = File.ReadAllText(pointerCachePath);
|
||||
|
||||
if (_fileSystem.FileExists(contentPath))
|
||||
if (File.Exists(contentPath))
|
||||
{
|
||||
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ namespace MediaBrowser.Api
|
||||
await DownloadImage(request.ProviderName, request.ImageUrl, urlHash, pointerCachePath).ConfigureAwait(false);
|
||||
|
||||
// Read the pointer file again
|
||||
contentPath = _fileSystem.ReadAllText(pointerCachePath);
|
||||
contentPath = File.ReadAllText(pointerCachePath);
|
||||
|
||||
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ namespace MediaBrowser.Api
|
||||
|
||||
var fullCachePath = GetFullCachePath(urlHash + "." + ext);
|
||||
|
||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fullCachePath));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(fullCachePath));
|
||||
using (var stream = result.Content)
|
||||
{
|
||||
using (var filestream = _fileSystem.GetFileStream(fullCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
|
||||
@@ -314,8 +314,8 @@ namespace MediaBrowser.Api
|
||||
}
|
||||
}
|
||||
|
||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(pointerCachePath));
|
||||
_fileSystem.WriteAllText(pointerCachePath, fullCachePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
|
||||
File.WriteAllText(pointerCachePath, fullCachePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -255,12 +255,12 @@ namespace MediaBrowser.Api.Library
|
||||
var currentPath = Path.Combine(rootFolderPath, request.Name);
|
||||
var newPath = Path.Combine(rootFolderPath, request.NewName);
|
||||
|
||||
if (!_fileSystem.DirectoryExists(currentPath))
|
||||
if (!Directory.Exists(currentPath))
|
||||
{
|
||||
throw new FileNotFoundException("The media collection does not exist");
|
||||
}
|
||||
|
||||
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && _fileSystem.DirectoryExists(newPath))
|
||||
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath))
|
||||
{
|
||||
throw new ArgumentException("Media library already exists at " + newPath + ".");
|
||||
}
|
||||
@@ -273,11 +273,11 @@ namespace MediaBrowser.Api.Library
|
||||
if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var tempPath = Path.Combine(rootFolderPath, Guid.NewGuid().ToString("N"));
|
||||
_fileSystem.MoveDirectory(currentPath, tempPath);
|
||||
Directory.Move(currentPath, tempPath);
|
||||
currentPath = tempPath;
|
||||
}
|
||||
|
||||
_fileSystem.MoveDirectory(currentPath, newPath);
|
||||
Directory.Move(currentPath, newPath);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace MediaBrowser.Api.Playback
|
||||
CancellationTokenSource cancellationTokenSource,
|
||||
string workingDirectory = null)
|
||||
{
|
||||
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(outputPath));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
|
||||
|
||||
await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace MediaBrowser.Api.Playback
|
||||
}
|
||||
|
||||
var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt");
|
||||
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(logFilePath));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
||||
|
||||
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
||||
state.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);
|
||||
@@ -290,7 +290,7 @@ namespace MediaBrowser.Api.Playback
|
||||
new JobLogger(Logger).StartStreamingLog(state, process.StandardError.BaseStream, state.LogFileStream);
|
||||
|
||||
// Wait for the file to exist before proceeeding
|
||||
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
||||
while (!File.Exists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
||||
{
|
||||
await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -83,13 +83,13 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
TranscodingJob job = null;
|
||||
var playlist = state.OutputFilePath;
|
||||
|
||||
if (!FileSystem.FileExists(playlist))
|
||||
if (!File.Exists(playlist))
|
||||
{
|
||||
var transcodingLock = ApiEntryPoint.Instance.GetTranscodingLock(playlist);
|
||||
await transcodingLock.WaitAsync(cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
if (!FileSystem.FileExists(playlist))
|
||||
if (!File.Exists(playlist))
|
||||
{
|
||||
// If the playlist doesn't already exist, startup ffmpeg
|
||||
try
|
||||
@@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
var useGenericSegmenter = true;
|
||||
if (useGenericSegmenter)
|
||||
{
|
||||
var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
|
||||
var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
|
||||
|
||||
var timeDeltaParam = string.Empty;
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
TranscodingJob job = null;
|
||||
|
||||
if (FileSystem.FileExists(segmentPath))
|
||||
if (File.Exists(segmentPath))
|
||||
{
|
||||
job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
|
||||
return await GetSegmentResult(state, playlistPath, segmentPath, segmentExtension, requestedIndex, job, cancellationToken).ConfigureAwait(false);
|
||||
@@ -177,7 +177,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
try
|
||||
{
|
||||
if (FileSystem.FileExists(segmentPath))
|
||||
if (File.Exists(segmentPath))
|
||||
{
|
||||
job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
|
||||
transcodingLock.Release();
|
||||
@@ -381,7 +381,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
private static FileSystemMetadata GetLastTranscodingFile(string playlist, string segmentExtension, IFileSystem fileSystem)
|
||||
{
|
||||
var folder = fileSystem.GetDirectoryName(playlist);
|
||||
var folder = Path.GetDirectoryName(playlist);
|
||||
|
||||
var filePrefix = Path.GetFileNameWithoutExtension(playlist) ?? string.Empty;
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
private string GetSegmentPath(StreamState state, string playlist, int index)
|
||||
{
|
||||
var folder = FileSystem.GetDirectoryName(playlist);
|
||||
var folder = Path.GetDirectoryName(playlist);
|
||||
|
||||
var filename = Path.GetFileNameWithoutExtension(playlist);
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
TranscodingJob transcodingJob,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var segmentFileExists = FileSystem.FileExists(segmentPath);
|
||||
var segmentFileExists = File.Exists(segmentPath);
|
||||
|
||||
// If all transcoding has completed, just return immediately
|
||||
if (transcodingJob != null && transcodingJob.HasExited && segmentFileExists)
|
||||
@@ -458,14 +458,14 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
try
|
||||
{
|
||||
var text = FileSystem.ReadAllText(playlistPath, Encoding.UTF8);
|
||||
var text = File.ReadAllText(playlistPath, Encoding.UTF8);
|
||||
|
||||
// If it appears in the playlist, it's done
|
||||
if (text.IndexOf(segmentFilename, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
if (!segmentFileExists)
|
||||
{
|
||||
segmentFileExists = FileSystem.FileExists(segmentPath);
|
||||
segmentFileExists = File.Exists(segmentPath);
|
||||
}
|
||||
if (segmentFileExists)
|
||||
{
|
||||
@@ -932,7 +932,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
var mapArgs = state.IsOutputVideo ? EncodingHelper.GetMapArgs(state) : string.Empty;
|
||||
|
||||
var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
|
||||
var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
|
||||
|
||||
var timeDeltaParam = string.Empty;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
@@ -153,7 +154,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
}
|
||||
|
||||
var outputPath = state.OutputFilePath;
|
||||
var outputPathExists = FileSystem.FileExists(outputPath);
|
||||
var outputPathExists = File.Exists(outputPath);
|
||||
|
||||
var transcodingJob = ApiEntryPoint.Instance.GetTranscodingJob(outputPath, TranscodingJobType.Progressive);
|
||||
var isTranscodeCached = outputPathExists && transcodingJob != null;
|
||||
@@ -377,7 +378,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
{
|
||||
TranscodingJob job;
|
||||
|
||||
if (!FileSystem.FileExists(outputPath))
|
||||
if (!File.Exists(outputPath))
|
||||
{
|
||||
job = await StartFfMpeg(state, outputPath, cancellationTokenSource).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,11 @@ namespace MediaBrowser.Api
|
||||
private readonly INetworkManager _network;
|
||||
private readonly IDeviceManager _deviceManager;
|
||||
|
||||
public PluginService(IJsonSerializer jsonSerializer, IApplicationHost appHost, IInstallationManager installationManager, INetworkManager network, IDeviceManager deviceManager)
|
||||
public PluginService(IJsonSerializer jsonSerializer,
|
||||
IApplicationHost appHost,
|
||||
IInstallationManager installationManager,
|
||||
INetworkManager network,
|
||||
IDeviceManager deviceManager)
|
||||
: base()
|
||||
{
|
||||
if (jsonSerializer == null)
|
||||
@@ -173,7 +177,7 @@ namespace MediaBrowser.Api
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public async Task<object> Get(GetRegistrationStatus request)
|
||||
public object Get(GetRegistrationStatus request)
|
||||
{
|
||||
var record = new MBRegistrationRecord
|
||||
{
|
||||
@@ -187,26 +191,12 @@ namespace MediaBrowser.Api
|
||||
return ToOptimizedResult(record);
|
||||
}
|
||||
|
||||
//TODO this function is only kept for compatibility and should be removed once paid plugins break
|
||||
public async Task<object> Get(GetRegistration request)
|
||||
{
|
||||
var info = new RegistrationInfo
|
||||
{
|
||||
ExpirationDate = DateTime.Now.AddYears(100),
|
||||
IsRegistered = true,
|
||||
IsTrial = false,
|
||||
Name = request.Name
|
||||
};
|
||||
|
||||
return ToOptimizedResult(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public async Task<object> Get(GetPlugins request)
|
||||
public object Get(GetPlugins request)
|
||||
{
|
||||
var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToArray();
|
||||
return ToOptimizedResult(result);
|
||||
@@ -230,7 +220,7 @@ namespace MediaBrowser.Api
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public async Task<object> Get(GetPluginSecurityInfo request)
|
||||
public object Get(GetPluginSecurityInfo request)
|
||||
{
|
||||
var result = new PluginSecurityInfo
|
||||
{
|
||||
|
||||
@@ -102,7 +102,8 @@ namespace MediaBrowser.Api
|
||||
return new StartupUser
|
||||
{
|
||||
Name = user.Name,
|
||||
ConnectUserName = user.ConnectUserName
|
||||
ConnectUserName = user.ConnectUserName,
|
||||
Password = user.Password
|
||||
};
|
||||
}
|
||||
|
||||
@@ -111,8 +112,13 @@ namespace MediaBrowser.Api
|
||||
var user = _userManager.Users.First();
|
||||
|
||||
user.Name = request.Name;
|
||||
|
||||
_userManager.UpdateUser(user);
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Password)) {
|
||||
await _userManager.ChangePassword(user, request.Password).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var result = new UpdateStartupUserResult();
|
||||
|
||||
return result;
|
||||
@@ -130,6 +136,7 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ConnectUserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateStartupUserResult
|
||||
|
||||
@@ -267,13 +267,13 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var session = GetSession(_sessionContext);
|
||||
|
||||
var dto = await UpdatePlayedStatus(user, request.Id, true, datePlayed).ConfigureAwait(false);
|
||||
var dto = UpdatePlayedStatus(user, request.Id, true, datePlayed);
|
||||
|
||||
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||
{
|
||||
var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId);
|
||||
|
||||
await UpdatePlayedStatus(additionalUser, request.Id, true, datePlayed).ConfigureAwait(false);
|
||||
UpdatePlayedStatus(additionalUser, request.Id, true, datePlayed);
|
||||
}
|
||||
|
||||
return dto;
|
||||
@@ -412,13 +412,13 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var session = GetSession(_sessionContext);
|
||||
|
||||
var dto = await UpdatePlayedStatus(user, request.Id, false, null).ConfigureAwait(false);
|
||||
var dto = UpdatePlayedStatus(user, request.Id, false, null);
|
||||
|
||||
foreach (var additionalUserInfo in session.AdditionalUsers)
|
||||
{
|
||||
var additionalUser = _userManager.GetUserById(additionalUserInfo.UserId);
|
||||
|
||||
await UpdatePlayedStatus(additionalUser, request.Id, false, null).ConfigureAwait(false);
|
||||
UpdatePlayedStatus(additionalUser, request.Id, false, null);
|
||||
}
|
||||
|
||||
return dto;
|
||||
@@ -432,7 +432,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
/// <param name="wasPlayed">if set to <c>true</c> [was played].</param>
|
||||
/// <param name="datePlayed">The date played.</param>
|
||||
/// <returns>Task.</returns>
|
||||
private async Task<UserItemDataDto> UpdatePlayedStatus(User user, string itemId, bool wasPlayed, DateTime? datePlayed)
|
||||
private UserItemDataDto UpdatePlayedStatus(User user, string itemId, bool wasPlayed, DateTime? datePlayed)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user