The Free Software Media System - Server Backend & API
fixes #295 - Add play to vlc option
Luke Pulverentia35f62a4a4fb
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.csindex f1f1858cb2..5702af6d1c 100644--- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs+++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs@@ -13,7 +13,6 @@ using System.Linq;using System.Net;using System.Net.Cache;using System.Net.Http;-using System.Reflection;using System.Text;using System.Threading;using System.Threading.Tasks;@@ -225,7 +224,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManagerif ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds){- throw new HttpException(string.Format("Cancelling connection to {0} due to a previous timeout.", options.Url)) { IsTimedOut = true };+ throw new HttpException(string.Format("Cancelling connection to {0} due to a previous timeout.", options.Url))+ {+ IsTimedOut = true+ };}var httpWebRequest = GetRequest(options, httpMethod, options.EnableHttpCompression);@@ -348,7 +350,15 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager{_logger.ErrorException("Error getting response from " + options.Url, ex);- return new HttpException(ex.Message, ex);+ var exception = new HttpException(ex.Message, ex);++ var response = ex.Response as HttpWebResponse;+ if (response != null)+ {+ exception.StatusCode = response.StatusCode;+ }++ return exception;}private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, Stream content, long? contentLength)@@ -658,7 +668,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager_logger.Error(msg);// Throw an HttpException so that the caller doesn't think it was cancelled by user code- return new HttpException(msg, exception) { IsTimedOut = true };+ return new HttpException(msg, exception)+ {+ IsTimedOut = true+ };}return exception;@@ -693,7 +706,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager}}- throw new HttpException(response.StatusDescription) { StatusCode = response.StatusCode };+ throw new HttpException(response.StatusDescription)+ {+ StatusCode = response.StatusCode+ };}}diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs b/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.csindex 39f747e0a5..f5b5db3fdf 100644--- a/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs+++ b/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs@@ -266,21 +266,28 @@ namespace MediaBrowser.Server.Implementations.Channelsprivate bool IsSizeLimitReached(string path, double gbLimit){- var byteLimit = gbLimit*1000000000;-- long total = 0;-- foreach (var file in new DirectoryInfo(path).EnumerateFiles("*", SearchOption.AllDirectories))+ try{- total += file.Length;+ var byteLimit = gbLimit * 1000000000;- if (total >= byteLimit)+ long total = 0;++ foreach (var file in new DirectoryInfo(path).EnumerateFiles("*", SearchOption.AllDirectories)){- return true;+ total += file.Length;++ if (total >= byteLimit)+ {+ return true;+ }}- }- return false;+ return false;+ }+ catch (DirectoryNotFoundException)+ {+ return false;+ }}private async Task RefreshMediaSourceItems(IEnumerable<MediaSourceInfo> items, CancellationToken cancellationToken)diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.csindex 0f2d2e3d5c..6479b6f9d2 100644--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs@@ -133,9 +133,8 @@ namespace MediaBrowser.Server.Implementations.Connect}catch (HttpException ex){- var webEx = (WebException) ex.InnerException;-- if (webEx == null || (webEx.Status != WebExceptionStatus.ProtocolError && ((HttpWebResponse)webEx.Response).StatusCode != HttpStatusCode.NotFound))+ if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound ||+ ex.StatusCode.Value != HttpStatusCode.Unauthorized){throw;}diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.csindex dc009f4a92..ad5eac0332 100644--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs@@ -845,9 +845,11 @@ namespace MediaBrowser.Server.Implementations.Libraryif (isArtist){+ var validFilename = _fileSystem.GetValidFilename(name).Trim();+var existing = RootFolder.RecursiveChildren.OfType<T>()- .FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));+ .FirstOrDefault(i => string.Equals(_fileSystem.GetValidFilename(i.Name).Trim(), validFilename, StringComparison.OrdinalIgnoreCase));if (existing != null){diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.jsonindex ffe56e3d9c..7cc5c7bccd 100644--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json@@ -462,5 +462,11 @@"ValueDiscNumber": "Disc {0}","HeaderUnknownDate": "Unknown Date","HeaderUnknownYear": "Unknown Year",- "ValueMinutes": "{0} min"+ "ValueMinutes": "{0} min",+ "ButtonPlayExternalPlayer": "Play with external player",+ "HeaderSelectExternalPlayer": "Select External Player",+ "HeaderExternalPlayerPlayback": "External Player Playback",+ "ButtonImDone": "I'm Done",+ "OptionMarkWatched": "Mark watched",+ "OptionMarkWatchedHelp": "Check this if you watched the entire video"}diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.jsonindex 2cae45a9d9..04fb29a085 100644--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json@@ -1166,5 +1166,5 @@"LabelConnectUserNameHelp": "Connect this user to a Media Browser account to enable easy sign-in access from any app without having to know the server ip address.","ButtonLearnMoreAboutMediaBrowserConnect": "Learn more about Media Browser Connect","LabelExternalPlayers": "External players:",- "LabelExternalPlayersHelp": "Display buttons to play content in external players. This is only available on devices that support url schemes, generally Android and iOS."+ "LabelExternalPlayersHelp": "Display buttons to play content in external players. This is only available on devices that support url schemes, generally Android and iOS. With external players there is generally no support for remote control, resuming, or reporting progress to the server."}diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.csindex 738650df77..541251c2b2 100644--- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs+++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs@@ -202,13 +202,16 @@ namespace MediaBrowser.ServerApplication.FFMpeg{IsWindows = Path.DirectorySeparatorChar == '\\';- //Don't call uname on windows+ // Don't call uname on windowsif (!IsWindows){var uname = GetUnixName();- IsMac = uname.sysname == "Darwin";- IsLinux = uname.sysname == "Linux";+ var sysName = uname.sysname ?? string.Empty;++ IsMac = string.Equals(sysName, "Darwin", StringComparison.OrdinalIgnoreCase);+ IsLinux = string.Equals(sysName, "Linux", StringComparison.OrdinalIgnoreCase) ||+ sysName.EndsWith("BSD", StringComparison.OrdinalIgnoreCase);var archX86 = new Regex("(i|I)[3-6]86");IsX86 = archX86.IsMatch(uname.machine);diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.csindex 2ee2efa221..a9765889fe 100644--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs@@ -572,6 +572,7 @@ namespace MediaBrowser.WebDashboard.Api"edititemimages.js","edititemsubtitles.js","encodingsettings.js",+ "externalplayer.js","favorites.js","gamesrecommendedpage.js","gamesystemspage.js",diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csprojindex 4fb5cea568..fdbd1d352d 100644--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj@@ -641,6 +641,9 @@<Content Include="dashboard-ui\scripts\autoorganizelog.js"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>+ <Content Include="dashboard-ui\scripts\externalplayer.js">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </Content><Content Include="dashboard-ui\scripts\favorites.js"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></Content>@@ -2101,7 +2104,13 @@</ItemGroup><ItemGroup><None Include="app.config" />- <None Include="dashboard-ui\css\fonts\gotham-book.woff">+ <None Include="dashboard-ui\css\fonts\mblogo.eot">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </None>+ <None Include="dashboard-ui\css\fonts\mblogo.ttf">+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>+ </None>+ <None Include="dashboard-ui\css\fonts\mblogo.woff"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory></None><None Include="dashboard-ui\css\fonts\RobotoBold.woff">