Linux fixes:

-Copy PropertyChanged.Fody.dll to Tools/Fody in MediaBrowser.Model.csproj
-Check if root for WebSocketServer.FlashAccessPolicyEnabled (port < 1024)
-Check resolution value !=0 before SetResolution
-Catch _userManager.RefreshUsersMetadata exception when running MB3 for the first time
-Fix _appHost.Init() missing argument
-FFmpeg: set default and execute permission(766) to ffmpeg and ffprobe
-FFmpeg: Detect the OS type and download the correct version 
-Rename MediaBrowser.WebDashboard/dashboard-ui/scripts/Itemdetailpage.js to itemdetailpage.js
This commit is contained in:
abeloin 2013-12-25 14:26:49 -05:00
parent bb5e6fdcad
commit 68cf16416b
9 changed files with 101 additions and 12 deletions

View File

@ -209,8 +209,9 @@
<PostBuildEvent Condition=" '$(ConfigurationName)' != 'Release Mono' ">if '$(ConfigurationName)' == 'Release' (
xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\net45\" /y /d /r /i
)</PostBuildEvent>
<PostBuildEvent Condition=" '$(ConfigurationName)' == 'Release Mono' ">cp -fu "$(MSBuildProjectDirectory)\..\packages\PropertyChanged.Fody.1.41.0.0\PropertyChanged.Fody.dll" "$(MSBuildProjectDirectory)\..\Tools\Fody\"</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " />
<Import Project="Fody.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -227,9 +227,18 @@ namespace MediaBrowser.Server.Implementations.Drawing
// Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here
using (var thumbnail = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppPArgb))
{
#if __MonoCS__
// Mono throw an exeception if assign 0 to SetResolution
if (originalImage.HorizontalResolution != 0 && originalImage.VerticalResolution != 0)
{
// Preserve the original resolution
thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);
}
#else
// Preserve the original resolution
thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);
#endif
using (var thumbnailGraph = Graphics.FromImage(thumbnail))
{

View File

@ -27,9 +27,20 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
/// Runs this instance.
/// </summary>
public async void Run()
{
#if __MonoCS__
try
{
await _userManager.RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false);
}
catch
{
System.Console.WriteLine("RefreshUsersMetadata task error: No users? First time running?");
}
#else
await _userManager.RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false);
#endif
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View File

@ -85,6 +85,7 @@
<Reference Include="ServiceStack.Text">
<HintPath>..\ThirdParty\ServiceStack.Text\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="Mono.Posix" Condition=" '$(ConfigurationName)' == 'Release Mono' " />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedVersion.cs">

View File

@ -4,6 +4,9 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Model.Logging;
using System;
using System.Net;
#if __MonoCS__
using Mono.Unix.Native;
#endif
namespace MediaBrowser.Server.Implementations.WebSocket
{
@ -66,6 +69,20 @@ namespace MediaBrowser.Server.Implementations.WebSocket
TimeOut = TimeSpan.FromHours(24)
};
#if __MonoCS__
//Linux: port below 1024 require root or cap_net_bind_service
if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
{
if (Syscall.getuid() == 0)
{
WebSocketServer.FlashAccessPolicyEnabled = true;
}
else
{
WebSocketServer.FlashAccessPolicyEnabled = false;
}
}
#endif
WebSocketServer.Start();
}
catch (Exception ex)

View File

@ -1,20 +1,57 @@

using System;
namespace MediaBrowser.ServerApplication.FFMpeg
{
public static class FFMpegDownloadInfo
{
public static string Version = "ffmpeg20130904";
public static string Version = ffmpegOsType("Version");
public static string[] FfMpegUrls = new[]
public static string[] FfMpegUrls = ffmpegOsType("FfMpegUrls").Split(',');
public static string FFMpegFilename = ffmpegOsType("FFMpegFilename");
public static string FFProbeFilename = ffmpegOsType("FFProbeFilename");
public static string ArchiveType = ffmpegOsType("ArchiveType");
private static string ffmpegOsType(string arg)
{
"http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.2013-10-11.tar.gz",
"https://www.dropbox.com/s/b9v17h105cps7p0/ffmpeg.static.32bit.2013-10-11.tar.gz?dl=1"
};
public static string FFMpegFilename = "ffmpeg";
public static string FFProbeFilename = "ffprobe";
public static string ArchiveType = "gz";
OperatingSystem os = Environment.OSVersion;
PlatformID pid = os.Platform;
switch (pid)
{
case PlatformID.Win32NT:
switch (arg)
{
case "Version":
return "ffmpeg20131221";
case "FfMpegUrls":
return "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20131221-git-70d6ce7-win32-static.7z,https://www.dropbox.com/s/d38uj7857trbw1g/ffmpeg-20131209-git-a12f679-win32-static.7z?dl=1";
case "FFMpegFilename":
return "ffmpeg.exe";
case "FFProbeFilename":
return "ffprobe.exe";
case "ArchiveType":
return "7z";
}
break;
case PlatformID.Unix:
case PlatformID.MacOSX:
switch (arg)
{
case "Version":
return "ffmpeg20131221";
case "FfMpegUrls":
return "http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.2013-12-21.tar.gz,https://www.dropbox.com/s/b9v17h105cps7p0/ffmpeg.static.32bit.2013-10-11.tar.gz?dl=1";
case "FFMpegFilename":
return "ffmpeg";
case "FFProbeFilename":
return "ffprobe";
case "ArchiveType":
return "gz";
}
break;
}
return "";
}
}
}

View File

@ -50,6 +50,7 @@
<Reference Include="ServiceStack.Interfaces">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath>
</Reference>
<Reference Include="Mono.Posix" Condition=" '$(ConfigurationName)' == 'Release Mono' "/>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedVersion.cs">

View File

@ -102,7 +102,9 @@ namespace MediaBrowser.Server.Mono
Console.WriteLine ("appHost.Init");
var task = _appHost.Init();
var initProgress = new Progress<double>();
var task = _appHost.Init(initProgress);
Task.WaitAll (task);
Console.WriteLine ("Running startup tasks");

View File

@ -12,6 +12,9 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
#if __MonoCS__
using Mono.Unix.Native;
#endif
namespace MediaBrowser.ServerApplication.FFMpeg
{
@ -147,6 +150,13 @@ namespace MediaBrowser.ServerApplication.FFMpeg
}))
{
File.Copy(file, Path.Combine(targetFolder, Path.GetFileName(file)), true);
#if __MonoCS__
//Linux: File permission to 666, and user's execute bit
if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
{
Syscall.chmod(Path.Combine(targetFolder, Path.GetFileName(file)), FilePermissions.DEFFILEMODE | FilePermissions.S_IXUSR);
}
#endif
}
}
finally