The Free Software Media System - Server Backend & API
3.2.40.1
Luke Pulverenti77695f8abed3
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.csindex bd0a9e1f42..9b2c703940 100644--- a/Emby.Dlna/PlayTo/PlayToController.cs+++ b/Emby.Dlna/PlayTo/PlayToController.cs@@ -321,6 +321,12 @@ namespace Emby.Dlna.PlayToAddItemFromId(Guid.Parse(id), items);}+ var startIndex = command.StartIndex ?? 0;+ if (startIndex > 0)+ {+ items = items.Skip(startIndex).ToList();+ }+var playlist = new List<PlaylistItem>();var isFirst = true;diff --git a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj b/Emby.Drawing.Skia/Emby.Drawing.Skia.csprojindex f2b32d52cb..2b61561cbc 100644--- a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj+++ b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj@@ -59,9 +59,6 @@<Compile Include="StripCollageBuilder.cs" /><Compile Include="UnplayedCountIndicator.cs" /></ItemGroup>- <ItemGroup>- <EmbeddedResource Include="fonts\robotoregular.ttf" />- </ItemGroup><ItemGroup><Reference Include="SkiaSharp, Version=1.58.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"><HintPath>..\packages\SkiaSharp.1.58.1\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.dll</HintPath>diff --git a/Emby.Drawing.Skia/PlayedIndicatorDrawer.cs b/Emby.Drawing.Skia/PlayedIndicatorDrawer.csindex 48f2da62bc..2417043d60 100644--- a/Emby.Drawing.Skia/PlayedIndicatorDrawer.cs+++ b/Emby.Drawing.Skia/PlayedIndicatorDrawer.cs@@ -15,7 +15,6 @@ namespace Emby.Drawing.Skia{public class PlayedIndicatorDrawer{- private const int FontSize = 42;private const int OffsetFromTopRightCorner = 38;private readonly IApplicationPaths _appPaths;@@ -44,48 +43,23 @@ namespace Emby.Drawing.Skia{paint.Color = new SKColor(255, 255, 255, 255);paint.Style = SKPaintStyle.Fill;- paint.Typeface = SKTypeface.FromFile(await DownloadFont("webdings.ttf", "https://github.com/MediaBrowser/Emby.Resources/raw/master/fonts/webdings.ttf",- _appPaths, _iHttpClient, _fileSystem).ConfigureAwait(false));- paint.TextSize = FontSize;- paint.IsAntialias = true;-- canvas.DrawText("a", (float)x-20, OffsetFromTopRightCorner + 12, paint);- }- }-- internal static string ExtractFont(string name, IApplicationPaths paths, IFileSystem fileSystem)- {- var filePath = Path.Combine(paths.ProgramDataPath, "fonts", name);-- if (fileSystem.FileExists(filePath))- {- return filePath;- }- var namespacePath = typeof(PlayedIndicatorDrawer).Namespace + ".fonts." + name;- var tempPath = Path.Combine(paths.TempDirectory, Guid.NewGuid().ToString("N") + ".ttf");- fileSystem.CreateDirectory(fileSystem.GetDirectoryName(tempPath));+ paint.TextSize = 30;+ paint.IsAntialias = true;- using (var stream = typeof(PlayedIndicatorDrawer).GetTypeInfo().Assembly.GetManifestResourceStream(namespacePath))- {- using (var fileStream = fileSystem.GetFileStream(tempPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))- {- stream.CopyTo(fileStream);- }- }+ var text = "✔️";+ var emojiChar = StringUtilities.GetUnicodeCharacterCode(text, SKTextEncoding.Utf32);+ // or:+ //var emojiChar = 0x1F680;- fileSystem.CreateDirectory(fileSystem.GetDirectoryName(filePath));+ // ask the font manager for a font with that character+ var fontManager = SKFontManager.Default;+ var emojiTypeface = fontManager.MatchCharacter(emojiChar);- try- {- fileSystem.CopyFile(tempPath, filePath, false);- }- catch (IOException)- {+ paint.Typeface = emojiTypeface;+ canvas.DrawText(text, (float)x-20, OffsetFromTopRightCorner + 12, paint);}-- return tempPath;}internal static async Task<string> DownloadFont(string name, string url, IApplicationPaths paths, IHttpClient httpClient, IFileSystem fileSystem)diff --git a/Emby.Drawing.Skia/UnplayedCountIndicator.cs b/Emby.Drawing.Skia/UnplayedCountIndicator.csindex 56a2519a3a..b59bc1026a 100644--- a/Emby.Drawing.Skia/UnplayedCountIndicator.cs+++ b/Emby.Drawing.Skia/UnplayedCountIndicator.cs@@ -40,7 +40,7 @@ namespace Emby.Drawing.Skia{paint.Color = new SKColor(255, 255, 255, 255);paint.Style = SKPaintStyle.Fill;- paint.Typeface = SKTypeface.FromFile(PlayedIndicatorDrawer.ExtractFont("robotoregular.ttf", _appPaths, _fileSystem));+paint.TextSize = 24;paint.IsAntialias = true;diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 745d83eb5f..531e13123a 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -2317,12 +2317,17 @@ namespace Emby.Server.Implementations}}- public void LaunchUrl(string url)+ public virtual void LaunchUrl(string url){if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX){- throw new NotImplementedException();+ throw new NotSupportedException();+ }++ if (!Environment.UserInteractive)+ {+ throw new NotSupportedException();}var process = ProcessFactory.Create(new ProcessOptionsdiff --git a/Emby.Server.Implementations/Browser/BrowserLauncher.cs b/Emby.Server.Implementations/Browser/BrowserLauncher.csindex 05cde91e22..71497f6bf8 100644--- a/Emby.Server.Implementations/Browser/BrowserLauncher.cs+++ b/Emby.Server.Implementations/Browser/BrowserLauncher.cs@@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.Browser{appHost.LaunchUrl(url);}- catch (NotImplementedException)+ catch (NotSupportedException){}diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.csindex 614c04fd22..8d13557952 100644--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs@@ -3,6 +3,7 @@ using Emby.Server.Implementations.Browser;using MediaBrowser.Controller;using MediaBrowser.Controller.Plugins;using MediaBrowser.Model.Logging;+using MediaBrowser.Controller.Configuration;namespace Emby.Server.Implementations.EntryPoints{@@ -20,15 +21,13 @@ namespace Emby.Server.Implementations.EntryPoints/// </summary>private readonly ILogger _logger;- /// <summary>- /// Initializes a new instance of the <see cref="StartupWizard" /> class.- /// </summary>- /// <param name="appHost">The app host.</param>- /// <param name="logger">The logger.</param>- public StartupWizard(IServerApplicationHost appHost, ILogger logger)+ private IServerConfigurationManager _config;++ public StartupWizard(IServerApplicationHost appHost, ILogger logger, IServerConfigurationManager config){_appHost = appHost;_logger = logger;+ _config = config;}/// <summary>@@ -38,16 +37,12 @@ namespace Emby.Server.Implementations.EntryPoints{if (_appHost.IsFirstRun){- LaunchStartupWizard();+ BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);+ }+ else if (_config.Configuration.IsStartupWizardCompleted)+ {+ BrowserLauncher.OpenDashboardPage("index.html", _appHost);}- }-- /// <summary>- /// Launches the startup wizard.- /// </summary>- private void LaunchStartupWizard()- {- BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);}/// <summary>diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.csindex 0f48ff46b8..c4e75add89 100644--- a/Emby.Server.Implementations/Library/UserManager.cs+++ b/Emby.Server.Implementations/Library/UserManager.cs@@ -218,7 +218,7 @@ namespace Emby.Server.Implementations.Libraryreturn builder.ToString();}- public async Task<User> AuthenticateUser(string username, string password, string hashedPassword, string passwordMd5, string remoteEndPoint)+ public async Task<User> AuthenticateUser(string username, string password, string hashedPassword, string passwordMd5, string remoteEndPoint, bool isUserSession){if (string.IsNullOrWhiteSpace(username)){@@ -288,8 +288,11 @@ namespace Emby.Server.Implementations.Library// Update LastActivityDate and LastLoginDate, then saveif (success){- user.LastActivityDate = user.LastLoginDate = DateTime.UtcNow;- UpdateUser(user);+ if (isUserSession)+ {+ user.LastActivityDate = user.LastLoginDate = DateTime.UtcNow;+ UpdateUser(user);+ }UpdateInvalidLoginAttemptCount(user, 0);}elsediff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.csindex c96d1f3592..e6c9b184e5 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs@@ -152,6 +152,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsisRemote = !_networkManager.IsInLocalNetwork(uri.Host);}+ var supportsDirectPlay = !info.EnableStreamLooping && info.TunerCount == 0;+var mediaSource = new MediaSourceInfo{Path = path,@@ -183,7 +185,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsIsInfiniteStream = true,IsRemote = isRemote,- IgnoreDts = true+ IgnoreDts = true,+ SupportsDirectPlay = supportsDirectPlay};mediaSource.InferTotalBitrate();diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.csindex cc2cb3e5ee..b8c7c7b18e 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs@@ -88,6 +88,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsSetTempFilePath(extension);var taskCompletionSource = new TaskCompletionSource<bool>();++ var now = DateTime.UtcNow;+StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);//OpenedMediaSource.Protocol = MediaProtocol.File;@@ -97,11 +100,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsOpenedMediaSource.Path = _appHost.GetLocalApiUrl("127.0.0.1") + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";OpenedMediaSource.Protocol = MediaProtocol.Http;- if (OpenedMediaSource.SupportsProbing)- {- await Task.Delay(3000).ConfigureAwait(false);- }-//OpenedMediaSource.Path = TempFilePath;//OpenedMediaSource.Protocol = MediaProtocol.File;@@ -111,6 +109,20 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts//OpenedMediaSource.SupportsDirectStream = true;//OpenedMediaSource.SupportsTranscoding = true;await taskCompletionSource.Task.ConfigureAwait(false);++ if (OpenedMediaSource.SupportsProbing)+ {+ var elapsed = (DateTime.UtcNow - now).TotalMilliseconds;++ var delay = Convert.ToInt32(3000 - elapsed);++ if (delay > 0)+ {+ Logger.Info("Delaying shared stream by {0}ms to allow the buffer to build.", delay);++ await Task.Delay(delay).ConfigureAwait(false);+ }+ }}protected override void CloseInternal()diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.csindex e1c1bbe2b8..e852544204 100644--- a/Emby.Server.Implementations/Session/HttpSessionController.cs+++ b/Emby.Server.Implementations/Session/HttpSessionController.cs@@ -117,6 +117,10 @@ namespace Emby.Server.Implementations.Session{dict["SubtitleStreamIndex"] = command.SubtitleStreamIndex.Value.ToString(CultureInfo.InvariantCulture);}+ if (command.StartIndex.HasValue)+ {+ dict["StartIndex"] = command.StartIndex.Value.ToString(CultureInfo.InvariantCulture);+ }if (!string.IsNullOrWhiteSpace(command.MediaSourceId)){dict["MediaSourceId"] = command.MediaSourceId;diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex 30f6e65218..411781b259 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -1423,7 +1423,7 @@ namespace Emby.Server.Implementations.Sessionif (enforcePassword){- var result = await _userManager.AuthenticateUser(request.Username, request.Password, request.PasswordSha1, request.PasswordMd5, request.RemoteEndPoint).ConfigureAwait(false);+ var result = await _userManager.AuthenticateUser(request.Username, request.Password, request.PasswordSha1, request.PasswordMd5, request.RemoteEndPoint, true).ConfigureAwait(false);if (result == null){diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.csindex ddefb08dff..66d6a024eb 100644--- a/MediaBrowser.Api/UserService.cs+++ b/MediaBrowser.Api/UserService.cs@@ -473,7 +473,7 @@ namespace MediaBrowser.Api}else{- var success = await _userManager.AuthenticateUser(user.Name, request.CurrentPw, request.CurrentPassword, null, Request.RemoteIp).ConfigureAwait(false);+ var success = await _userManager.AuthenticateUser(user.Name, request.CurrentPw, request.CurrentPassword, null, Request.RemoteIp, false).ConfigureAwait(false);if (success == null){diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.csindex d4232c77e0..03e1d352e2 100644--- a/MediaBrowser.Controller/Library/IUserManager.cs+++ b/MediaBrowser.Controller/Library/IUserManager.cs@@ -143,7 +143,7 @@ namespace MediaBrowser.Controller.Library/// <summary>/// Authenticates the user./// </summary>- Task<User> AuthenticateUser(string username, string password, string passwordSha1, string passwordMd5, string remoteEndPoint);+ Task<User> AuthenticateUser(string username, string password, string passwordSha1, string passwordMd5, string remoteEndPoint, bool isUserSession);/// <summary>/// Starts the forgot password process.diff --git a/MediaBrowser.Model/Session/PlayRequest.cs b/MediaBrowser.Model/Session/PlayRequest.csindex d50cb59533..3477f2e574 100644--- a/MediaBrowser.Model/Session/PlayRequest.cs+++ b/MediaBrowser.Model/Session/PlayRequest.cs@@ -37,5 +37,6 @@ namespace MediaBrowser.Model.Sessionpublic int? SubtitleStreamIndex { get; set; }public int? AudioStreamIndex { get; set; }public string MediaSourceId { get; set; }+ public int? StartIndex { get; set; }}}\ No newline at end of filediff --git a/SharedVersion.cs b/SharedVersion.csindex 580bc70016..99dc764dfd 100644--- a/SharedVersion.cs+++ b/SharedVersion.cs@@ -1,3 +1,3 @@using System.Reflection;-[assembly: AssemblyVersion("3.2.40.0")]+[assembly: AssemblyVersion("3.2.40.1")]