fixes #295 - Add play to vlc option

This commit is contained in:
Luke Pulverenti 2014-09-15 23:33:30 -04:00
parent cbbc7269fa
commit a35f62a4a4
9 changed files with 69 additions and 26 deletions

View File

@ -13,7 +13,6 @@ using System.Linq;
using System.Net; using System.Net;
using System.Net.Cache; using System.Net.Cache;
using System.Net.Http; using System.Net.Http;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -225,7 +224,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
if ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds) if ((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); 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); _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) private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, Stream content, long? contentLength)
@ -658,7 +668,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
_logger.Error(msg); _logger.Error(msg);
// Throw an HttpException so that the caller doesn't think it was cancelled by user code // 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; 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
};
} }
} }

View File

@ -266,7 +266,9 @@ namespace MediaBrowser.Server.Implementations.Channels
private bool IsSizeLimitReached(string path, double gbLimit) private bool IsSizeLimitReached(string path, double gbLimit)
{ {
var byteLimit = gbLimit*1000000000; try
{
var byteLimit = gbLimit * 1000000000;
long total = 0; long total = 0;
@ -282,6 +284,11 @@ namespace MediaBrowser.Server.Implementations.Channels
return false; return false;
} }
catch (DirectoryNotFoundException)
{
return false;
}
}
private async Task RefreshMediaSourceItems(IEnumerable<MediaSourceInfo> items, CancellationToken cancellationToken) private async Task RefreshMediaSourceItems(IEnumerable<MediaSourceInfo> items, CancellationToken cancellationToken)
{ {

View File

@ -133,9 +133,8 @@ namespace MediaBrowser.Server.Implementations.Connect
} }
catch (HttpException ex) catch (HttpException ex)
{ {
var webEx = (WebException) ex.InnerException; if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound ||
ex.StatusCode.Value != HttpStatusCode.Unauthorized)
if (webEx == null || (webEx.Status != WebExceptionStatus.ProtocolError && ((HttpWebResponse)webEx.Response).StatusCode != HttpStatusCode.NotFound))
{ {
throw; throw;
} }

View File

@ -845,9 +845,11 @@ namespace MediaBrowser.Server.Implementations.Library
if (isArtist) if (isArtist)
{ {
var validFilename = _fileSystem.GetValidFilename(name).Trim();
var existing = RootFolder.RecursiveChildren var existing = RootFolder.RecursiveChildren
.OfType<T>() .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) if (existing != null)
{ {

View File

@ -462,5 +462,11 @@
"ValueDiscNumber": "Disc {0}", "ValueDiscNumber": "Disc {0}",
"HeaderUnknownDate": "Unknown Date", "HeaderUnknownDate": "Unknown Date",
"HeaderUnknownYear": "Unknown Year", "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"
} }

View File

@ -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.", "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", "ButtonLearnMoreAboutMediaBrowserConnect": "Learn more about Media Browser Connect",
"LabelExternalPlayers": "External players:", "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."
} }

View File

@ -202,13 +202,16 @@ namespace MediaBrowser.ServerApplication.FFMpeg
{ {
IsWindows = Path.DirectorySeparatorChar == '\\'; IsWindows = Path.DirectorySeparatorChar == '\\';
//Don't call uname on windows // Don't call uname on windows
if (!IsWindows) if (!IsWindows)
{ {
var uname = GetUnixName(); var uname = GetUnixName();
IsMac = uname.sysname == "Darwin"; var sysName = uname.sysname ?? string.Empty;
IsLinux = uname.sysname == "Linux";
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"); var archX86 = new Regex("(i|I)[3-6]86");
IsX86 = archX86.IsMatch(uname.machine); IsX86 = archX86.IsMatch(uname.machine);

View File

@ -572,6 +572,7 @@ namespace MediaBrowser.WebDashboard.Api
"edititemimages.js", "edititemimages.js",
"edititemsubtitles.js", "edititemsubtitles.js",
"encodingsettings.js", "encodingsettings.js",
"externalplayer.js",
"favorites.js", "favorites.js",
"gamesrecommendedpage.js", "gamesrecommendedpage.js",
"gamesystemspage.js", "gamesystemspage.js",

View File

@ -641,6 +641,9 @@
<Content Include="dashboard-ui\scripts\autoorganizelog.js"> <Content Include="dashboard-ui\scripts\autoorganizelog.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\scripts\externalplayer.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\favorites.js"> <Content Include="dashboard-ui\scripts\favorites.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -2101,7 +2104,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <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> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="dashboard-ui\css\fonts\RobotoBold.woff"> <None Include="dashboard-ui\css\fonts\RobotoBold.woff">