update image magick sharp

pull/702/head
Luke Pulverenti 9 years ago
parent 3d22c48670
commit 0d8636d859

@ -34,6 +34,7 @@ namespace MediaBrowser.Controller.Library
event EventHandler<GenericEventArgs<User>> UserCreated;
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
event EventHandler<GenericEventArgs<User>> UserLockedOut;
/// <summary>
/// Gets a User by Id

@ -19,6 +19,7 @@ namespace MediaBrowser.Model.Notifications
NewLibraryContentMultiple,
ServerRestartRequired,
TaskFailed,
CameraImageUploaded
CameraImageUploaded,
UserLockedOut
}
}

@ -1,5 +1,6 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using System;
using System.IO;
using System.Linq;
@ -14,6 +15,11 @@ namespace MediaBrowser.Server.Implementations.Devices
public override bool IsVisible(User user)
{
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
return GetChildren(user, true).Any() &&
base.IsVisible(user);
}

@ -350,9 +350,9 @@ namespace MediaBrowser.Server.Implementations.Drawing
}
/// <summary>
/// Increment this when indicator drawings change
/// Increment this when there's a change requiring caches to be invalidated
/// </summary>
private const string IndicatorVersion = "2";
private const string Version = "3";
/// <summary>
/// Gets the cache file path based on a set of parameters
@ -371,29 +371,19 @@ namespace MediaBrowser.Server.Implementations.Drawing
filename += "f=" + format;
var hasIndicator = false;
if (addPlayedIndicator)
{
filename += "pl=true";
hasIndicator = true;
}
if (percentPlayed > 0)
{
filename += "p=" + percentPlayed;
hasIndicator = true;
}
if (unwatchedCount.HasValue)
{
filename += "p=" + unwatchedCount.Value;
hasIndicator = true;
}
if (hasIndicator)
{
filename += "iv=" + IndicatorVersion;
}
if (!string.IsNullOrEmpty(backgroundColor))
@ -401,6 +391,8 @@ namespace MediaBrowser.Server.Implementations.Drawing
filename += "b=" + backgroundColor;
}
filename += "v=" + Version;
return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower());
}
@ -671,30 +663,6 @@ namespace MediaBrowser.Server.Implementations.Drawing
return enhancedImagePath;
}
private ImageFormat GetFormat(string path)
{
var extension = Path.GetExtension(path);
if (string.Equals(extension, ".png", StringComparison.OrdinalIgnoreCase))
{
return ImageFormat.Png;
}
if (string.Equals(extension, ".gif", StringComparison.OrdinalIgnoreCase))
{
return ImageFormat.Gif;
}
if (string.Equals(extension, ".webp", StringComparison.OrdinalIgnoreCase))
{
return ImageFormat.Webp;
}
if (string.Equals(extension, ".bmp", StringComparison.OrdinalIgnoreCase))
{
return ImageFormat.Bmp;
}
return ImageFormat.Jpg;
}
/// <summary>
/// Executes the image enhancers.
/// </summary>

@ -86,6 +86,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_userManager.UserPasswordChanged += _userManager_UserPasswordChanged;
_userManager.UserDeleted += _userManager_UserDeleted;
_userManager.UserConfigurationUpdated += _userManager_UserConfigurationUpdated;
_userManager.UserLockedOut += _userManager_UserLockedOut;
//_config.ConfigurationUpdated += _config_ConfigurationUpdated;
//_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
@ -95,6 +96,16 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
}
void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)
{
CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserLockedOutWithName"), e.Argument.Name),
Type = "UserLockedOut",
UserId = e.Argument.Id.ToString("N")
});
}
void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
{
CreateLogEntry(new ActivityLogEntry
@ -482,6 +493,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_userManager.UserPasswordChanged -= _userManager_UserPasswordChanged;
_userManager.UserDeleted -= _userManager_UserDeleted;
_userManager.UserConfigurationUpdated -= _userManager_UserConfigurationUpdated;
_userManager.UserLockedOut -= _userManager_UserLockedOut;
_config.ConfigurationUpdated -= _config_ConfigurationUpdated;
_config.NamedConfigurationUpdated -= _config_NamedConfigurationUpdated;

@ -78,6 +78,22 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
_appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged;
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
_deviceManager.CameraImageUploaded +=_deviceManager_CameraImageUploaded;
_userManager.UserLockedOut += _userManager_UserLockedOut;
}
async void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)
{
var type = NotificationType.UserLockedOut.ToString();
var notification = new NotificationRequest
{
NotificationType = type
};
notification.Variables["UserName"] = e.Argument.Name;
await SendNotification(notification).ConfigureAwait(false);
}
async void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
@ -235,7 +251,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
return;
}
var notification = new NotificationRequest
{
NotificationType = type
@ -471,6 +486,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
_appHost.ApplicationUpdated -= _appHost_ApplicationUpdated;
_deviceManager.CameraImageUploaded -= _deviceManager_CameraImageUploaded;
_userManager.UserLockedOut -= _userManager_UserLockedOut;
}
private void DisposeLibraryUpdateTimer()

@ -97,6 +97,7 @@ namespace MediaBrowser.Server.Implementations.Library
/// </summary>
public event EventHandler<GenericEventArgs<User>> UserUpdated;
public event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
public event EventHandler<GenericEventArgs<User>> UserLockedOut;
/// <summary>
/// Called when [user updated].
@ -281,13 +282,25 @@ namespace MediaBrowser.Server.Implementations.Library
3 :
5;
var fireLockout = false;
if (newValue >= maxCount)
{
_logger.Debug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture));
user.Policy.IsDisabled = true;
fireLockout = true;
}
await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false);
if (fireLockout)
{
if (UserLockedOut != null)
{
EventHelper.FireEventIfNotNull(UserLockedOut, this, new GenericEventArgs<User>(user), _logger);
}
}
}
}

@ -48,8 +48,10 @@
"LabelDashboardSourcePathHelp": "If running the server from source, specify the path to the dashboard-ui folder. All web client files will be served from this location.",
"ButtonConvertMedia": "Convert media",
"ButtonOrganize": "Organize",
"LabelPinCode": "Pin code:",
"ButtonOk": "Ok",
"ButtonCancel": "Cancel",
"ButtonExit": "Exit",
"ButtonNew": "New",
"HeaderTV": "TV",
"HeaderAudio": "Audio",
@ -57,6 +59,12 @@
"HeaderPaths": "Paths",
"CategorySync": "Sync",
"HeaderEasyPinCode": "Easy Pin Code",
"HeaderGrownupsOnly": "Grown-ups Only!",
"DividerOr": "-- or --",
"HeaderToAccessPleaseEnterEasyPinCode": "To access, please enter your easy pin code",
"KidsModeAdultInstruction": "Click the lock icon in the bottom right to configure or leave kids mode. Your pin code will be required.",
"ButtonConfigurePinCode": "Configure pin code",
"HeaderAdultsReadHere": "Adults Read Here!",
"RegisterWithPayPal": "Register with PayPal",
"HeaderSyncRequiresSupporterMembership": "Sync Requires a Supporter Membership",
"HeaderEnjoyDayTrial": "Enjoy a 14 Day Free Trial",
@ -670,6 +678,7 @@
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionNewLibraryContentMultiple": "New content added (multiple)",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
"NotificationOptionUserLockedOut": "User locked out",
"SendNotificationHelp": "By default, notifications are delivered to the dashboard inbox. Browse the plugin catalog to install additional notification options.",
"NotificationOptionServerRestartRequired": "Server restart required",
"LabelNotificationEnabled": "Enable this notification",
@ -1061,6 +1070,7 @@
"OptionBox": "Box",
"OptionBoxRear": "Box rear",
"OptionDisc": "Disc",
"OptionIcon": "Icon",
"OptionLogo": "Logo",
"OptionMenu": "Menu",
"OptionScreenshot": "Screenshot",
@ -1105,6 +1115,7 @@
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}",
"LabelRunningTimeValue": "Running time: {0}",
"LabelIpAddressValue": "Ip address: {0}",
"UserLockedOutWithName": "User {0} has been locked out",
"UserConfigurationUpdatedWithName": "User configuration has been updated for {0}",
"UserCreatedWithName": "User {0} has been created",
"UserPasswordChangedWithName": "Password has been changed for user {0}",

@ -47,7 +47,7 @@
<ItemGroup>
<Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ImageMagickSharp.1.0.0.4\lib\net45\ImageMagickSharp.dll</HintPath>
<HintPath>..\packages\ImageMagickSharp.1.0.0.5\lib\net45\ImageMagickSharp.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Naming, Version=1.0.5509.27636, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

@ -143,6 +143,13 @@ namespace MediaBrowser.Server.Implementations.Notifications
Type = NotificationType.CameraImageUploaded.ToString(),
DefaultTitle = "A new camera image has been uploaded from {DeviceName}.",
Variables = new List<string>{"DeviceName"}
},
new NotificationTypeInfo
{
Type = NotificationType.UserLockedOut.ToString(),
DefaultTitle = "{UserName} has been locked out.",
Variables = new List<string>{"UserName"}
}
};
@ -185,6 +192,10 @@ namespace MediaBrowser.Server.Implementations.Notifications
{
note.Category = _localization.GetLocalizedString("CategorySync");
}
else if (note.Type.IndexOf("UserLockedOut", StringComparison.OrdinalIgnoreCase) != -1)
{
note.Category = _localization.GetLocalizedString("CategoryUser");
}
else
{
note.Category = _localization.GetLocalizedString("CategorySystem");

@ -399,7 +399,7 @@ namespace MediaBrowser.Server.Implementations.Session
Client = clientType,
DeviceId = deviceId,
ApplicationVersion = appVersion,
Id = Guid.NewGuid().ToString("N")
Id = key.GetMD5().ToString("N")
};
sessionInfo.DeviceName = deviceName;
@ -798,6 +798,19 @@ namespace MediaBrowser.Server.Implementations.Session
return session;
}
private SessionInfo GetSessionToRemoteControl(string sessionId)
{
// Accept either device id or session id
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId));
if (session == null)
{
throw new ResourceNotFoundException(string.Format("Session {0} not found.", sessionId));
}
return session;
}
public Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken)
{
var generalCommand = new GeneralCommand
@ -818,7 +831,7 @@ namespace MediaBrowser.Server.Implementations.Session
public Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken)
{
var session = GetSession(sessionId);
var session = GetSessionToRemoteControl(sessionId);
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);
@ -828,7 +841,7 @@ namespace MediaBrowser.Server.Implementations.Session
public Task SendPlayCommand(string controllingSessionId, string sessionId, PlayRequest command, CancellationToken cancellationToken)
{
var session = GetSession(sessionId);
var session = GetSessionToRemoteControl(sessionId);
var user = session.UserId.HasValue ? _userManager.GetUserById(session.UserId.Value) : null;
@ -955,7 +968,7 @@ namespace MediaBrowser.Server.Implementations.Session
public Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken)
{
var session = GetSession(sessionId);
var session = GetSessionToRemoteControl(sessionId);
var controllingSession = GetSession(controllingSessionId);
AssertCanControl(session, controllingSession);

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ImageMagickSharp" version="1.0.0.4" targetFramework="net45" />
<package id="ImageMagickSharp" version="1.0.0.5" targetFramework="net45" />
<package id="MediaBrowser.Naming" version="1.0.0.32" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" />
<package id="morelinq" version="1.1.0" targetFramework="net45" />

@ -62,7 +62,7 @@
<ItemGroup>
<Reference Include="ImageMagickSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ImageMagickSharp.1.0.0.4\lib\net45\ImageMagickSharp.dll</HintPath>
<HintPath>..\packages\ImageMagickSharp.1.0.0.5\lib\net45\ImageMagickSharp.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.IsoMounter">
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ImageMagickSharp" version="1.0.0.4" targetFramework="net45" />
<package id="ImageMagickSharp" version="1.0.0.5" targetFramework="net45" />
<package id="MediaBrowser.IsoMounting" version="3.0.69" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" />
</packages>

@ -421,6 +421,7 @@ namespace MediaBrowser.WebDashboard.Api
"itembynamedetailpage.js",
"itemdetailpage.js",
"itemlistpage.js",
"kids.js",
"librarypathmapping.js",
"reports.js",
"librarysettings.js",

@ -87,6 +87,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="dashboard-ui\css\images\kids\bg.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\server.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -114,6 +117,9 @@
<Content Include="dashboard-ui\forgotpasswordpin.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\kids.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\mysync.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -129,6 +135,9 @@
<Content Include="dashboard-ui\scripts\forgotpasswordpin.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\kids.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\selectserver.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

@ -520,4 +520,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal

Loading…
Cancel
Save