fixes #552 - Add parental control usage limits

This commit is contained in:
Luke Pulverenti 2014-10-14 20:05:09 -04:00
parent 52776df012
commit bd1bd5e87e
34 changed files with 326 additions and 94 deletions

View File

@ -321,6 +321,20 @@ namespace MediaBrowser.Api.Images
{ {
var fileInfo = new FileInfo(info.Path); var fileInfo = new FileInfo(info.Path);
int? width = null;
int? height = null;
try
{
var size = _imageProcessor.GetImageSize(info.Path, info.DateModified);
width = Convert.ToInt32(size.Width);
height = Convert.ToInt32(size.Height);
}
catch
{
}
return new ImageInfo return new ImageInfo
{ {
Path = info.Path, Path = info.Path,
@ -328,8 +342,8 @@ namespace MediaBrowser.Api.Images
ImageType = info.Type, ImageType = info.Type,
ImageTag = _imageProcessor.GetImageCacheTag(item, info), ImageTag = _imageProcessor.GetImageCacheTag(item, info),
Size = fileInfo.Length, Size = fileInfo.Length,
Width = info.Width ?? 0, Width = width,
Height = info.Height ?? 0 Height = height
}; };
} }
catch (Exception ex) catch (Exception ex)

View File

@ -564,6 +564,11 @@ namespace MediaBrowser.Controller.Entities
return PlayAccess.None; return PlayAccess.None;
} }
//if (!user.IsParentalScheduleAllowed())
//{
// return PlayAccess.None;
//}
return PlayAccess.Full; return PlayAccess.Full;
} }
@ -1465,8 +1470,6 @@ namespace MediaBrowser.Controller.Entities
image.Path = file.FullName; image.Path = file.FullName;
image.DateModified = imageInfo.DateModified; image.DateModified = imageInfo.DateModified;
image.Width = imageInfo.Width;
image.Height = imageInfo.Height;
} }
} }
@ -1639,26 +1642,12 @@ namespace MediaBrowser.Controller.Entities
private ItemImageInfo GetImageInfo(FileSystemInfo file, ImageType type) private ItemImageInfo GetImageInfo(FileSystemInfo file, ImageType type)
{ {
var info = new ItemImageInfo return new ItemImageInfo
{ {
Path = file.FullName, Path = file.FullName,
Type = type, Type = type,
DateModified = FileSystem.GetLastWriteTimeUtc(file) DateModified = FileSystem.GetLastWriteTimeUtc(file)
}; };
try
{
var size = ImageProcessor.GetImageSize(info.Path);
info.Width = Convert.ToInt32(size.Width);
info.Height = Convert.ToInt32(size.Height);
}
catch
{
}
return info;
} }
/// <summary> /// <summary>

View File

@ -10,9 +10,5 @@ namespace MediaBrowser.Controller.Entities
public ImageType Type { get; set; } public ImageType Type { get; set; }
public DateTime DateModified { get; set; } public DateTime DateModified { get; set; }
public int? Width { get; set; }
public int? Height { get; set; }
} }
} }

View File

@ -6,6 +6,7 @@ using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.IO; using System.IO;
using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -259,5 +260,41 @@ namespace MediaBrowser.Controller.Entities
Configuration = config; Configuration = config;
UserManager.UpdateConfiguration(this, Configuration); UserManager.UpdateConfiguration(this, Configuration);
} }
public bool IsParentalScheduleAllowed()
{
return IsParentalScheduleAllowed(DateTime.UtcNow);
}
public bool IsParentalScheduleAllowed(DateTime date)
{
var schedules = Configuration.AccessSchedules;
if (schedules.Length == 0)
{
return true;
}
return schedules.Any(i => IsParentalScheduleAllowed(i, date));
}
private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date)
{
if (date.Kind != DateTimeKind.Utc)
{
throw new ArgumentException("Utc date expected");
}
var localTime = date.ToLocalTime();
return localTime.DayOfWeek == schedule.DayOfWeek && IsWithinTime(schedule, localTime);
}
private bool IsWithinTime(AccessSchedule schedule, DateTime localTime)
{
var hour = localTime.TimeOfDay.TotalHours;
return hour >= schedule.StartHour && hour <= schedule.EndHour;
}
} }
} }

View File

@ -129,6 +129,7 @@ namespace MediaBrowser.Controller.Entities
public bool IsPlaceHolder { get; set; } public bool IsPlaceHolder { get; set; }
public bool IsShortcut { get; set; } public bool IsShortcut { get; set; }
public string ShortcutPath { get; set; }
/// <summary> /// <summary>
/// Gets or sets the tags. /// Gets or sets the tags.
@ -578,6 +579,28 @@ namespace MediaBrowser.Controller.Entities
PlayableStreamFileNames = i.PlayableStreamFileNames.ToList() PlayableStreamFileNames = i.PlayableStreamFileNames.ToList()
}; };
if (i.IsShortcut)
{
info.Path = i.ShortcutPath;
if (info.Path.StartsWith("Http", StringComparison.OrdinalIgnoreCase))
{
info.Protocol = MediaProtocol.Http;
}
else if (info.Path.StartsWith("Rtmp", StringComparison.OrdinalIgnoreCase))
{
info.Protocol = MediaProtocol.Rtmp;
}
else if (info.Path.StartsWith("Rtsp", StringComparison.OrdinalIgnoreCase))
{
info.Protocol = MediaProtocol.Rtsp;
}
else
{
info.Protocol = MediaProtocol.File;
}
}
if (string.IsNullOrEmpty(info.Container)) if (string.IsNullOrEmpty(info.Container))
{ {
if (i.VideoType == VideoType.VideoFile || i.VideoType == VideoType.Iso) if (i.VideoType == VideoType.VideoFile || i.VideoType == VideoType.Iso)

View File

@ -99,7 +99,6 @@
<Compile Include="Collections\CollectionCreationOptions.cs" /> <Compile Include="Collections\CollectionCreationOptions.cs" />
<Compile Include="Collections\CollectionEvents.cs" /> <Compile Include="Collections\CollectionEvents.cs" />
<Compile Include="Collections\ICollectionManager.cs" /> <Compile Include="Collections\ICollectionManager.cs" />
<Compile Include="Connect\ConnectUser.cs" />
<Compile Include="Connect\IConnectManager.cs" /> <Compile Include="Connect\IConnectManager.cs" />
<Compile Include="Connect\UserLinkResult.cs" /> <Compile Include="Connect\UserLinkResult.cs" />
<Compile Include="Devices\IDeviceManager.cs" /> <Compile Include="Devices\IDeviceManager.cs" />

View File

@ -869,11 +869,9 @@ namespace MediaBrowser.Dlna.Didl
} }
int? width = imageInfo.Width; int? width = null;
int? height = imageInfo.Height; int? height = null;
if (!height.HasValue && !width.HasValue)
{
try try
{ {
var size = _imageProcessor.GetImageSize(imageInfo.Path, imageInfo.DateModified); var size = _imageProcessor.GetImageSize(imageInfo.Path, imageInfo.DateModified);
@ -885,7 +883,6 @@ namespace MediaBrowser.Dlna.Didl
{ {
} }
}
return new ImageDownloadInfo return new ImageDownloadInfo
{ {

View File

@ -158,6 +158,9 @@
<Compile Include="..\MediaBrowser.Model\Collections\CollectionCreationResult.cs"> <Compile Include="..\MediaBrowser.Model\Collections\CollectionCreationResult.cs">
<Link>Collections\CollectionCreationResult.cs</Link> <Link>Collections\CollectionCreationResult.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Configuration\AccessSchedule.cs">
<Link>Configuration\AccessSchedule.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs"> <Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs">
<Link>Configuration\BaseApplicationConfiguration.cs</Link> <Link>Configuration\BaseApplicationConfiguration.cs</Link>
</Compile> </Compile>
@ -215,9 +218,27 @@
<Compile Include="..\MediaBrowser.Model\Configuration\XbmcMetadataOptions.cs"> <Compile Include="..\MediaBrowser.Model\Configuration\XbmcMetadataOptions.cs">
<Link>Configuration\XbmcMetadataOptions.cs</Link> <Link>Configuration\XbmcMetadataOptions.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectAuthenticationResult.cs">
<Link>Connect\ConnectAuthenticationResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectAuthorization.cs"> <Compile Include="..\MediaBrowser.Model\Connect\ConnectAuthorization.cs">
<Link>Connect\ConnectAuthorization.cs</Link> <Link>Connect\ConnectAuthorization.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectUser.cs">
<Link>Connect\ConnectUser.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectUserQuery.cs">
<Link>Connect\ConnectUserQuery.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\PinCreationResult.cs">
<Link>Connect\PinCreationResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\PinExchangeResult.cs">
<Link>Connect\PinExchangeResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\PinStatusResult.cs">
<Link>Connect\PinStatusResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\UserLinkType.cs"> <Compile Include="..\MediaBrowser.Model\Connect\UserLinkType.cs">
<Link>Connect\UserLinkType.cs</Link> <Link>Connect\UserLinkType.cs</Link>
</Compile> </Compile>

View File

@ -124,6 +124,9 @@
<Compile Include="..\MediaBrowser.Model\Collections\CollectionCreationResult.cs"> <Compile Include="..\MediaBrowser.Model\Collections\CollectionCreationResult.cs">
<Link>Collections\CollectionCreationResult.cs</Link> <Link>Collections\CollectionCreationResult.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Configuration\AccessSchedule.cs">
<Link>Configuration\AccessSchedule.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs"> <Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs">
<Link>Configuration\BaseApplicationConfiguration.cs</Link> <Link>Configuration\BaseApplicationConfiguration.cs</Link>
</Compile> </Compile>
@ -181,9 +184,27 @@
<Compile Include="..\MediaBrowser.Model\Configuration\XbmcMetadataOptions.cs"> <Compile Include="..\MediaBrowser.Model\Configuration\XbmcMetadataOptions.cs">
<Link>Configuration\XbmcMetadataOptions.cs</Link> <Link>Configuration\XbmcMetadataOptions.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectAuthenticationResult.cs">
<Link>Connect\ConnectAuthenticationResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectAuthorization.cs"> <Compile Include="..\MediaBrowser.Model\Connect\ConnectAuthorization.cs">
<Link>Connect\ConnectAuthorization.cs</Link> <Link>Connect\ConnectAuthorization.cs</Link>
</Compile> </Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectUser.cs">
<Link>Connect\ConnectUser.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\ConnectUserQuery.cs">
<Link>Connect\ConnectUserQuery.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\PinCreationResult.cs">
<Link>Connect\PinCreationResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\PinExchangeResult.cs">
<Link>Connect\PinExchangeResult.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Connect\PinStatusResult.cs">
<Link>Connect\PinStatusResult.cs</Link>
</Compile>
<Compile Include="..\mediabrowser.model\connect\UserLinkType.cs"> <Compile Include="..\mediabrowser.model\connect\UserLinkType.cs">
<Link>Connect\UserLinkType.cs</Link> <Link>Connect\UserLinkType.cs</Link>
</Compile> </Compile>

View File

@ -715,10 +715,10 @@ namespace MediaBrowser.Model.ApiClient
/// Authenticates a user and returns the result /// Authenticates a user and returns the result
/// </summary> /// </summary>
/// <param name="username">The username.</param> /// <param name="username">The username.</param>
/// <param name="sha1Hash">The sha1 hash.</param> /// <param name="password">The password.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
/// <exception cref="ArgumentNullException">userId</exception> /// <exception cref="ArgumentNullException">userId</exception>
Task<AuthenticationResult> AuthenticateUserAsync(string username, byte[] sha1Hash); Task<AuthenticationResult> AuthenticateUserAsync(string username, string password);
/// <summary> /// <summary>
/// Updates the server configuration async. /// Updates the server configuration async.

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using System; using System;
using System.Threading; using System.Threading;
@ -65,5 +66,25 @@ namespace MediaBrowser.Model.ApiClient
/// </summary> /// </summary>
[Obsolete] [Obsolete]
IApiClient CurrentApiClient { get; } IApiClient CurrentApiClient { get; }
/// <summary>
/// Creates the pin.
/// </summary>
/// <returns>Task&lt;PinCreationResult&gt;.</returns>
Task<PinCreationResult> CreatePin();
/// <summary>
/// Gets the pin status.
/// </summary>
/// <param name="pin">The pin.</param>
/// <returns>Task&lt;PinStatusResult&gt;.</returns>
Task<PinStatusResult> GetPinStatus(PinCreationResult pin);
/// <summary>
/// Exchanges the pin.
/// </summary>
/// <param name="pin">The pin.</param>
/// <returns>Task.</returns>
Task ExchangePin(PinCreationResult pin);
} }
} }

View File

@ -0,0 +1,23 @@
using System;
namespace MediaBrowser.Model.Configuration
{
public class AccessSchedule
{
/// <summary>
/// Gets or sets the day of week.
/// </summary>
/// <value>The day of week.</value>
public DayOfWeek DayOfWeek { get; set; }
/// <summary>
/// Gets or sets the start hour.
/// </summary>
/// <value>The start hour.</value>
public double StartHour { get; set; }
/// <summary>
/// Gets or sets the end hour.
/// </summary>
/// <value>The end hour.</value>
public double EndHour { get; set; }
}
}

View File

@ -86,13 +86,14 @@ namespace MediaBrowser.Model.Configuration
public bool EnableCinemaMode { get; set; } public bool EnableCinemaMode { get; set; }
public AccessSchedule[] AccessSchedules { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class. /// Initializes a new instance of the <see cref="UserConfiguration" /> class.
/// </summary> /// </summary>
public UserConfiguration() public UserConfiguration()
{ {
PlayDefaultAudioTrack = true; PlayDefaultAudioTrack = true;
EnableRemoteControlOfOtherUsers = true;
EnableLiveTvManagement = true; EnableLiveTvManagement = true;
EnableMediaPlayback = true; EnableMediaPlayback = true;
EnableLiveTvAccess = true; EnableLiveTvAccess = true;
@ -111,6 +112,8 @@ namespace MediaBrowser.Model.Configuration
SyncConnectImage = true; SyncConnectImage = true;
IncludeTrailersInSuggestions = true; IncludeTrailersInSuggestions = true;
EnableCinemaMode = true; EnableCinemaMode = true;
AccessSchedules = new AccessSchedule[] { };
} }
} }
} }

View File

@ -0,0 +1,17 @@

namespace MediaBrowser.Model.Connect
{
public class ConnectAuthenticationResult
{
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public string UserId { get; set; }
/// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>The access token.</value>
public string AccessToken { get; set; }
}
}

View File

@ -1,5 +1,5 @@
 
namespace MediaBrowser.Controller.Connect namespace MediaBrowser.Model.Connect
{ {
public class ConnectUser public class ConnectUser
{ {
@ -9,11 +9,4 @@ namespace MediaBrowser.Controller.Connect
public bool IsActive { get; set; } public bool IsActive { get; set; }
public string ImageUrl { get; set; } public string ImageUrl { get; set; }
} }
public class ConnectUserQuery
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
} }

View File

@ -0,0 +1,10 @@

namespace MediaBrowser.Model.Connect
{
public class ConnectUserQuery
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
}

View File

@ -0,0 +1,11 @@

namespace MediaBrowser.Model.Connect
{
public class PinCreationResult
{
public string Pin { get; set; }
public string DeviceId { get; set; }
public bool IsConfirmed { get; set; }
public bool IsExpired { get; set; }
}
}

View File

@ -0,0 +1,10 @@
using System;
namespace MediaBrowser.Model.Connect
{
public class PinExchangeResult
{
public string UserId { get; set; }
public string UserAccessToken { get; set; }
}
}

View File

@ -0,0 +1,10 @@

namespace MediaBrowser.Model.Connect
{
public class PinStatusResult
{
public string Pin { get; set; }
public bool IsConfirmed { get; set; }
public bool IsExpired { get; set; }
}
}

View File

@ -1,5 +1,4 @@
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using System;
namespace MediaBrowser.Model.Dto namespace MediaBrowser.Model.Dto
{ {
@ -35,13 +34,13 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the height. /// Gets or sets the height.
/// </summary> /// </summary>
/// <value>The height.</value> /// <value>The height.</value>
public int Height { get; set; } public int? Height { get; set; }
/// <summary> /// <summary>
/// Gets or sets the width. /// Gets or sets the width.
/// </summary> /// </summary>
/// <value>The width.</value> /// <value>The width.</value>
public int Width { get; set; } public int? Width { get; set; }
/// <summary> /// <summary>
/// Gets or sets the size. /// Gets or sets the size.

View File

@ -89,6 +89,7 @@
<Compile Include="Chapters\RemoteChapterInfo.cs" /> <Compile Include="Chapters\RemoteChapterInfo.cs" />
<Compile Include="Chapters\RemoteChapterResult.cs" /> <Compile Include="Chapters\RemoteChapterResult.cs" />
<Compile Include="Collections\CollectionCreationResult.cs" /> <Compile Include="Collections\CollectionCreationResult.cs" />
<Compile Include="Configuration\AccessSchedule.cs" />
<Compile Include="Configuration\ChannelOptions.cs" /> <Compile Include="Configuration\ChannelOptions.cs" />
<Compile Include="Configuration\ChapterOptions.cs" /> <Compile Include="Configuration\ChapterOptions.cs" />
<Compile Include="Configuration\CinemaModeConfiguration.cs" /> <Compile Include="Configuration\CinemaModeConfiguration.cs" />
@ -96,7 +97,13 @@
<Compile Include="Configuration\PeopleMetadataOptions.cs" /> <Compile Include="Configuration\PeopleMetadataOptions.cs" />
<Compile Include="Configuration\XbmcMetadataOptions.cs" /> <Compile Include="Configuration\XbmcMetadataOptions.cs" />
<Compile Include="Configuration\SubtitlePlaybackMode.cs" /> <Compile Include="Configuration\SubtitlePlaybackMode.cs" />
<Compile Include="Connect\ConnectAuthenticationResult.cs" />
<Compile Include="Connect\ConnectAuthorization.cs" /> <Compile Include="Connect\ConnectAuthorization.cs" />
<Compile Include="Connect\ConnectUser.cs" />
<Compile Include="Connect\ConnectUserQuery.cs" />
<Compile Include="Connect\PinCreationResult.cs" />
<Compile Include="Connect\PinExchangeResult.cs" />
<Compile Include="Connect\PinStatusResult.cs" />
<Compile Include="Connect\UserLinkType.cs" /> <Compile Include="Connect\UserLinkType.cs" />
<Compile Include="Devices\DeviceOptions.cs" /> <Compile Include="Devices\DeviceOptions.cs" />
<Compile Include="Devices\LocalFileInfo.cs" /> <Compile Include="Devices\LocalFileInfo.cs" />

View File

@ -4,6 +4,7 @@ namespace MediaBrowser.Model.MediaInfo
{ {
File = 0, File = 0,
Http = 1, Http = 1,
Rtmp = 2 Rtmp = 2,
Rtsp = 3
} }
} }

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.Configuration; using System.IO;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Chapters; using MediaBrowser.Controller.Chapters;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
@ -132,16 +133,27 @@ namespace MediaBrowser.Providers.MediaInfo
return _cachedTask; return _cachedTask;
} }
if (item.IsPlaceHolder || item.IsShortcut) if (item.IsPlaceHolder)
{ {
return _cachedTask; return _cachedTask;
} }
if (item.IsShortcut)
{
FetchShortcutInfo(item);
return Task.FromResult(ItemUpdateType.MetadataEdit);
}
var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager); var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager);
return prober.ProbeVideo(item, options, cancellationToken); return prober.ProbeVideo(item, options, cancellationToken);
} }
private void FetchShortcutInfo(Video video)
{
video.ShortcutPath = File.ReadAllText(video.Path);
}
public Task<ItemUpdateType> FetchAudioInfo<T>(T item, CancellationToken cancellationToken) public Task<ItemUpdateType> FetchAudioInfo<T>(T item, CancellationToken cancellationToken)
where T : Audio where T : Audio
{ {

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
@ -17,10 +18,12 @@ namespace MediaBrowser.Providers.Photos
public class PhotoProvider : ICustomMetadataProvider<Photo>, IHasItemChangeMonitor public class PhotoProvider : ICustomMetadataProvider<Photo>, IHasItemChangeMonitor
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IImageProcessor _imageProcessor;
public PhotoProvider(ILogger logger) public PhotoProvider(ILogger logger, IImageProcessor imageProcessor)
{ {
_logger = logger; _logger = logger;
_imageProcessor = imageProcessor;
} }
public Task<ItemUpdateType> FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken) public Task<ItemUpdateType> FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken)
@ -141,8 +144,17 @@ namespace MediaBrowser.Providers.Photos
var imageInfo = item.GetImageInfo(ImageType.Primary, 0); var imageInfo = item.GetImageInfo(ImageType.Primary, 0);
item.Height = imageInfo.Height; try
item.Width = imageInfo.Width; {
var size = _imageProcessor.GetImageSize(imageInfo.Path, imageInfo.DateModified);
item.Width = Convert.ToInt32(size.Width);
item.Height = Convert.ToInt32(size.Height);
}
catch
{
}
const ItemUpdateType result = ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataImport; const ItemUpdateType result = ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataImport;
return Task.FromResult(result); return Task.FromResult(result);

View File

@ -634,6 +634,7 @@ namespace MediaBrowser.Server.Implementations.Connect
user.Configuration.SyncConnectImage = true; user.Configuration.SyncConnectImage = true;
user.Configuration.SyncConnectName = true; user.Configuration.SyncConnectName = true;
user.Configuration.IsHidden = true;
_userManager.UpdateConfiguration(user, user.Configuration); _userManager.UpdateConfiguration(user, user.Configuration);
} }

View File

@ -1429,13 +1429,8 @@ namespace MediaBrowser.Server.Implementations.Dto
// See if we can avoid a file system lookup by looking for the file in ResolveArgs // See if we can avoid a file system lookup by looking for the file in ResolveArgs
var dateModified = imageInfo.DateModified; var dateModified = imageInfo.DateModified;
double? width = imageInfo.Width;
double? height = imageInfo.Height;
ImageSize size; ImageSize size;
if (!width.HasValue || !height.HasValue)
{
try try
{ {
size = _imageProcessor.GetImageSize(path, dateModified); size = _imageProcessor.GetImageSize(path, dateModified);
@ -1450,15 +1445,6 @@ namespace MediaBrowser.Server.Implementations.Dto
_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path); _logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path);
return; return;
} }
}
else
{
size = new ImageSize
{
Height = height.Value,
Width = width.Value
};
}
dto.OriginalPrimaryImageAspectRatio = size.Width / size.Height; dto.OriginalPrimaryImageAspectRatio = size.Width / size.Height;

View File

@ -67,7 +67,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
{ {
if (!_config.Configuration.InsecureApps.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase)) if (!_config.Configuration.InsecureApps.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{ {
//SessionManager.ValidateSecurityToken(auth.Token); SessionManager.ValidateSecurityToken(auth.Token);
} }
} }
@ -80,11 +80,19 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
throw new ArgumentException("User with Id " + auth.UserId + " not found"); throw new ArgumentException("User with Id " + auth.UserId + " not found");
} }
if (user != null && user.Configuration.IsDisabled) if (user != null)
{
if (user.Configuration.IsDisabled)
{ {
throw new AuthenticationException("User account has been disabled."); throw new AuthenticationException("User account has been disabled.");
} }
if (!user.Configuration.IsAdministrator && !user.IsParentalScheduleAllowed())
{
throw new AuthenticationException("This user account is not allowed access at this time.");
}
}
if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase)) if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase))
{ {
if (user == null || !user.Configuration.IsAdministrator) if (user == null || !user.Configuration.IsAdministrator)

View File

@ -234,6 +234,7 @@ namespace MediaBrowser.Server.Implementations.Library
users.Add(user); users.Add(user);
user.Configuration.IsAdministrator = true; user.Configuration.IsAdministrator = true;
user.Configuration.EnableRemoteControlOfOtherUsers = true;
UpdateConfiguration(user, user.Configuration); UpdateConfiguration(user, user.Configuration);
} }

View File

@ -609,5 +609,8 @@
"DeleteDeviceConfirmation": "Are you sure you wish to delete this device? It will reappear the next time a user signs in with it.", "DeleteDeviceConfirmation": "Are you sure you wish to delete this device? It will reappear the next time a user signs in with it.",
"LabelEnableCameraUploadFor": "Enable camera upload for:", "LabelEnableCameraUploadFor": "Enable camera upload for:",
"HeaderSelectUploadPath": "Select Upload Path", "HeaderSelectUploadPath": "Select Upload Path",
"LabelEnableCameraUploadForHelp": "Uploads will occur automatically in the background when signed into Media Browser." "LabelEnableCameraUploadForHelp": "Uploads will occur automatically in the background when signed into Media Browser.",
"ErrorMessageStartHourGreaterThanEnd": "End time must be greater than the start time.",
"ButtonLibraryAccess": "Library access",
"ButtonParentalControl": "Parental control"
} }

View File

@ -1235,5 +1235,12 @@
"HeaderGuests": "Guests", "HeaderGuests": "Guests",
"HeaderLocalUsers": "Local Users", "HeaderLocalUsers": "Local Users",
"HeaderPendingInvitations": "Pending Invitations", "HeaderPendingInvitations": "Pending Invitations",
"TabParentalControl": "Parental Control" "TabParentalControl": "Parental Control",
"HeaderAccessSchedule": "Access Schedule",
"HeaderAccessScheduleHelp": "Create an access schedule to limit access to certain hours.",
"ButtonAddSchedule": "Add Schedule",
"LabelAccessDay": "Day of week:",
"LabelAccessStart": "Start time:",
"LabelAccessEnd": "End time:",
"HeaderSchedule": "Schedule"
} }

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.482</version> <version>3.0.484</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.482" /> <dependency id="MediaBrowser.Common" version="3.0.484" />
<dependency id="NLog" version="3.1.0.0" /> <dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.5.2" /> <dependency id="SimpleInjector" version="2.5.2" />
<dependency id="sharpcompress" version="0.10.2" /> <dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.482</version> <version>3.0.484</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Model.Signed</id> <id>MediaBrowser.Model.Signed</id>
<version>3.0.482</version> <version>3.0.484</version>
<title>MediaBrowser.Model - Signed Edition</title> <title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.482</version> <version>3.0.484</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.482" /> <dependency id="MediaBrowser.Common" version="3.0.484" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>