From 02f749c654a5af4525304ed3ee470ba40c6405b9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 22 Dec 2016 18:53:57 -0500 Subject: update shortcut handling --- .../Native/LnkShortcutHandler.cs | 69 +--------------------- MediaBrowser.ServerApplication/WindowsAppHost.cs | 24 +++++--- 2 files changed, 19 insertions(+), 74 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs index 91ff7033e..b4a87b9b4 100644 --- a/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs +++ b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Runtime.InteropServices; +using System.Runtime.InteropServices.ComTypes; using System.Security; using System.Text; using MediaBrowser.Model.IO; @@ -52,7 +53,7 @@ namespace MediaBrowser.ServerApplication.Native /// /// The STG m_ READ /// - public const uint STGM_READ = 0; + public const int STGM_READ = 0; } /// @@ -319,72 +320,6 @@ namespace MediaBrowser.ServerApplication.Native } - /// - /// Interface IPersist - /// - [ComImport, Guid("0000010c-0000-0000-c000-000000000046"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IPersist - { - /// - /// Gets the class ID. - /// - /// The p class ID. - [PreserveSig] - void GetClassID(out Guid pClassID); - } - - /// - /// Interface IPersistFile - /// - [ComImport, Guid("0000010b-0000-0000-C000-000000000046"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface IPersistFile : IPersist - { - /// - /// Gets the class ID. - /// - /// The p class ID. - new void GetClassID(out Guid pClassID); - /// - /// Determines whether this instance is dirty. - /// - [PreserveSig] - int IsDirty(); - - /// - /// Loads the specified PSZ file name. - /// - /// Name of the PSZ file. - /// The dw mode. - [PreserveSig] - void Load([In, MarshalAs(UnmanagedType.LPWStr)] - string pszFileName, uint dwMode); - - /// - /// Saves the specified PSZ file name. - /// - /// Name of the PSZ file. - /// if set to true [remember]. - [PreserveSig] - void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName, - [In, MarshalAs(UnmanagedType.Bool)] bool remember); - - /// - /// Saves the completed. - /// - /// Name of the PSZ file. - [PreserveSig] - void SaveCompleted([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName); - - /// - /// Gets the cur file. - /// - /// Name of the PPSZ file. - [PreserveSig] - void GetCurFile([In, MarshalAs(UnmanagedType.LPWStr)] string ppszFileName); - } - // CLSID_ShellLink from ShlGuid.h /// /// Class ShellLink diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index c2cdb9ab0..398d21f32 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; +using System.Runtime.InteropServices.ComTypes; using Emby.Server.Core; using Emby.Server.Implementations; using Emby.Server.Implementations.EntryPoints; @@ -93,21 +94,30 @@ namespace MediaBrowser.ServerApplication protected override void ConfigureAutoRunInternal(bool autorun) { - var shortcutPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk"); - var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup); - if (autorun) + if (autorun && !MainStartup.IsRunningAsService) { //Copy our shortut into the startup folder for this user - var targetPath = Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk"); - FileSystemManager.CreateDirectory(Path.GetDirectoryName(targetPath)); - File.Copy(shortcutPath, targetPath, true); + var targetPath = Path.Combine(startupPath, "Emby Server.lnk"); + + IShellLinkW link = (IShellLinkW)new ShellLink(); + + var appPath = Process.GetCurrentProcess().MainModule.FileName; + + // setup shortcut information + link.SetDescription(Name); + link.SetPath(appPath); + link.SetWorkingDirectory(Path.GetDirectoryName(appPath)); + + // save it + IPersistFile file = (IPersistFile)link; + file.Save(targetPath, false); } else { //Remove our shortcut from the startup folder for this user - FileSystemManager.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk")); + FileSystemManager.DeleteFile(Path.Combine(startupPath, "Emby Server.lnk")); } } -- cgit v1.2.3 From 5833aedb15c2943109389d90979712978f1b2add Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 23 Dec 2016 03:50:32 -0500 Subject: update bitrate filter --- Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs | 2 +- MediaBrowser.Api/Playback/BaseStreamingService.cs | 2 +- MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | 2 +- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 2 ++ MediaBrowser.ServerApplication/WindowsAppHost.cs | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs index d75815847..5f37025e2 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.ScheduledTasks new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, - TimeOfDayTicks = TimeSpan.FromHours(1).Ticks, + TimeOfDayTicks = TimeSpan.FromHours(2).Ticks, MaxRuntimeMs = Convert.ToInt32(TimeSpan.FromHours(4).TotalMilliseconds) } }; diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 6545d995c..5e450567a 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1467,7 +1467,7 @@ namespace MediaBrowser.Api.Playback } // h264 - return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}", + return string.Format(" -maxrate {0} -bufsize {1}", bitrate.Value.ToString(UsCulture), (bitrate.Value * 2).ToString(UsCulture)); } diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index b8087fded..d7789a5fd 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -816,7 +816,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } // h264 - return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}", + return string.Format(" -maxrate {0} -bufsize {1}", bitrate.Value.ToString(UsCulture), (bitrate.Value * 2).ToString(UsCulture)); } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 116a6a7cf..89730a11f 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -287,6 +287,8 @@ namespace MediaBrowser.MediaEncoding.Encoder return; } + _logger.Info("Attempting to update encoder path to {0}. pathType: {1}", path ?? string.Empty, pathType ?? string.Empty); + Tuple newPaths; if (string.Equals(pathType, "system", StringComparison.OrdinalIgnoreCase)) diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index 398d21f32..ec66923aa 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -112,7 +112,7 @@ namespace MediaBrowser.ServerApplication // save it IPersistFile file = (IPersistFile)link; - file.Save(targetPath, false); + file.Save(targetPath, true); } else { -- cgit v1.2.3