diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-13 00:55:56 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-13 00:55:56 -0400 |
| commit | baf44b2718162c7f1d4f3061e438efbafc22201b (patch) | |
| tree | 168e28a37bb4af62c195c0777703c5eae4eab72b | |
| parent | 8b630e2d41697ce2ff8b93b7904d884fc96058f4 (diff) | |
3.0.5306.42925
21 files changed, 191 insertions, 109 deletions
diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.cs index c83028bb2..29848cfc0 100644 --- a/MediaBrowser.Api/ConfigurationService.cs +++ b/MediaBrowser.Api/ConfigurationService.cs @@ -122,42 +122,44 @@ namespace MediaBrowser.Api return ToOptimizedResult(result); } + const string XbmcMetadata = "Xbmc Nfo"; + const string MediaBrowserMetadata = "Media Browser Xml"; + public void Post(AutoSetMetadataOptions request) { var service = AutoDetectMetadataService(); Logger.Info("Setting preferred metadata format to " + service); - _configurationManager.SetPreferredMetadataService(service); + var serviceToDisable = string.Equals(service, XbmcMetadata) ? + MediaBrowserMetadata : + XbmcMetadata; + + _configurationManager.DisableMetadataService(serviceToDisable); _configurationManager.SaveConfiguration(); } private string AutoDetectMetadataService() { - const string xbmc = "Xbmc Nfo"; - const string mb = "Media Browser Xml"; - var paths = _libraryManager.GetDefaultVirtualFolders() .SelectMany(i => i.Locations) .Distinct(StringComparer.OrdinalIgnoreCase) .Select(i => new DirectoryInfo(i)) .ToList(); - if (paths.Select(i => i.EnumerateFiles("*.xml", SearchOption.AllDirectories)) - .SelectMany(i => i) + if (paths.SelectMany(i => i.EnumerateFiles("*.xml", SearchOption.AllDirectories)) .Any()) { - return xbmc; + return XbmcMetadata; } - if (paths.Select(i => i.EnumerateFiles("*.xml", SearchOption.AllDirectories)) - .SelectMany(i => i) + if (paths.SelectMany(i => i.EnumerateFiles("*.xml", SearchOption.AllDirectories)) .Any(i => string.Equals(i.Name, "series.xml", StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, "movie.xml", StringComparison.OrdinalIgnoreCase))) { - return mb; + return MediaBrowserMetadata; } - return xbmc; + return XbmcMetadata; } /// <summary> diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index db6c6ce53..1fa1a5509 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -65,6 +65,11 @@ namespace MediaBrowser.Api } } + private DateTime NormalizeDateTime(DateTime val) + { + return DateTime.SpecifyKind(val, DateTimeKind.Utc); + } + private void UpdateItem(BaseItemDto request, BaseItem item) { item.Name = request.Name; @@ -140,11 +145,11 @@ namespace MediaBrowser.Api if (request.DateCreated.HasValue) { - item.DateCreated = request.DateCreated.Value.ToUniversalTime(); + item.DateCreated = NormalizeDateTime(request.DateCreated.Value); } - item.EndDate = request.EndDate.HasValue ? request.EndDate.Value.ToUniversalTime() : (DateTime?)null; - item.PremiereDate = request.PremiereDate.HasValue ? request.PremiereDate.Value.ToUniversalTime() : (DateTime?)null; + item.EndDate = request.EndDate.HasValue ? NormalizeDateTime(request.EndDate.Value) : (DateTime?)null; + item.PremiereDate = request.PremiereDate.HasValue ? NormalizeDateTime(request.PremiereDate.Value) : (DateTime?)null; item.ProductionYear = request.ProductionYear; item.OfficialRating = request.OfficialRating; item.CustomRating = request.CustomRating; diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs index 178199b22..df4bc06ba 100644 --- a/MediaBrowser.Api/UserService.cs +++ b/MediaBrowser.Api/UserService.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; @@ -11,6 +12,7 @@ using ServiceStack.Text.Controller; using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; namespace MediaBrowser.Api @@ -168,6 +170,7 @@ namespace MediaBrowser.Api private readonly IDtoService _dtoService; private readonly ISessionManager _sessionMananger; private readonly IServerConfigurationManager _config; + private readonly INetworkManager _networkManager; public IAuthorizationContext AuthorizationContext { get; set; } @@ -178,12 +181,13 @@ namespace MediaBrowser.Api /// <param name="dtoService">The dto service.</param> /// <param name="sessionMananger">The session mananger.</param> /// <exception cref="System.ArgumentNullException">xmlSerializer</exception> - public UserService(IUserManager userManager, IDtoService dtoService, ISessionManager sessionMananger, IServerConfigurationManager config) + public UserService(IUserManager userManager, IDtoService dtoService, ISessionManager sessionMananger, IServerConfigurationManager config, INetworkManager networkManager) { _userManager = userManager; _dtoService = dtoService; _sessionMananger = sessionMananger; _config = config; + _networkManager = networkManager; } public object Get(GetPublicUsers request) @@ -200,18 +204,65 @@ namespace MediaBrowser.Api }); } - // TODO: Add or is authenticated - if (_sessionMananger.IsInLocalNetwork(Request.RemoteIp)) + // TODO: Uncomment this once all clients can handle an empty user list. + return Get(new GetUsers { - return Get(new GetUsers + IsHidden = false, + IsDisabled = false + }); + + //// TODO: Add or is authenticated + //if (Request.IsLocal || IsInLocalNetwork(Request.RemoteIp)) + //{ + // return Get(new GetUsers + // { + // IsHidden = false, + // IsDisabled = false + // }); + //} + + //// Return empty when external + //return ToOptimizedResult(new List<UserDto>()); + } + + private bool IsInLocalNetwork(string remoteEndpoint) + { + if (string.IsNullOrWhiteSpace(remoteEndpoint)) + { + throw new ArgumentNullException("remoteEndpoint"); + } + + IPAddress address; + if (!IPAddress.TryParse(remoteEndpoint, out address)) + { + return true; + } + + const int lengthMatch = 4; + + if (remoteEndpoint.Length >= lengthMatch) + { + var prefix = remoteEndpoint.Substring(0, lengthMatch); + + if (_networkManager.GetLocalIpAddresses() + .Any(i => i.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))) { - IsHidden = false, - IsDisabled = false - }); + return true; + } } - // Return empty when external - return ToOptimizedResult(new List<UserDto>()); + // Private address space: + // http://en.wikipedia.org/wiki/Private_network + + return + + // If url was requested with computer name, we may see this + remoteEndpoint.IndexOf("::", StringComparison.OrdinalIgnoreCase) != -1 || + + remoteEndpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || + remoteEndpoint.StartsWith("192.", StringComparison.OrdinalIgnoreCase) || + remoteEndpoint.StartsWith("172.", StringComparison.OrdinalIgnoreCase) || + remoteEndpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase); } /// <summary> @@ -307,7 +358,7 @@ namespace MediaBrowser.Api var auth = AuthorizationContext.GetAuthorizationInfo(Request); var result = _sessionMananger.AuthenticateNewSession(request.Username, request.Password, auth.Client, auth.Version, - auth.DeviceId, auth.Device, Request.RemoteIp).Result; + auth.DeviceId, auth.Device, Request.RemoteIp, Request.IsLocal).Result; return ToOptimizedResult(result); } diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index 751ff55a5..e4c88e656 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -177,17 +177,27 @@ namespace MediaBrowser.Common.Implementations.Updates { if (_lastPackageListResult != null) { - // Let dev users get results more often for testing purposes - var cacheLength = _config.CommonConfiguration.SystemUpdateLevel == PackageVersionClass.Dev - ? TimeSpan.FromMinutes(3) - : TimeSpan.FromHours(6); + TimeSpan cacheLength; + + switch (_config.CommonConfiguration.SystemUpdateLevel) + { + case PackageVersionClass.Beta: + cacheLength = TimeSpan.FromMinutes(30); + break; + case PackageVersionClass.Dev: + cacheLength = TimeSpan.FromMinutes(3); + break; + default: + cacheLength = TimeSpan.FromHours(6); + break; + } if ((DateTime.UtcNow - _lastPackageListResult.Item2) < cacheLength) { return _lastPackageListResult.Item1; } } - + using (var json = await _httpClient.Get(Constants.Constants.MbAdminUrl + "service/MB3Packages.json", cancellationToken).ConfigureAwait(false)) { cancellationToken.ThrowIfCancellationRequested(); @@ -274,7 +284,7 @@ namespace MediaBrowser.Common.Implementations.Updates { var packages = await GetAvailablePackages(CancellationToken.None).ConfigureAwait(false); - var package = packages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase)) + var package = packages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase)) ?? packages.FirstOrDefault(p => p.name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (package == null) @@ -310,7 +320,7 @@ namespace MediaBrowser.Common.Implementations.Updates /// <returns>PackageVersionInfo.</returns> public PackageVersionInfo GetLatestCompatibleVersion(IEnumerable<PackageInfo> availablePackages, string name, string guid, Version currentServerVersion, PackageVersionClass classification = PackageVersionClass.Release) { - var package = availablePackages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase)) + var package = availablePackages.FirstOrDefault(p => string.Equals(p.guid, guid ?? "none", StringComparison.OrdinalIgnoreCase)) ?? availablePackages.FirstOrDefault(p => p.name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (package == null) diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs index c3d1796f9..aac8cda2e 100644 --- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -31,6 +31,6 @@ namespace MediaBrowser.Controller.Configuration /// Sets the preferred metadata service. /// </summary> /// <param name="service">The service.</param> - void SetPreferredMetadataService(string service); + void DisableMetadataService(string service); } } diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 42178c44c..ff94ceff3 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -15,6 +15,21 @@ namespace MediaBrowser.Controller.Resolvers public static class EntityResolutionHelper { /// <summary> + /// Any folder named in this list will be ignored - can be added to at runtime for extensibility + /// </summary> + public static readonly List<string> IgnoreFolders = new List<string> + { + "metadata", + "ps3_update", + "ps3_vprm", + "extrafanart", + "extrathumbs", + ".actors", + ".wd_tv" + + }; + + /// <summary> /// Any extension in this list is considered a video file - can be added to at runtime for extensibility /// </summary> public static List<string> VideoFileExtensions = new List<string> diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index c8ae0e6a7..e37a13923 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -218,6 +218,7 @@ namespace MediaBrowser.Controller.Session /// <param name="deviceId">The device identifier.</param> /// <param name="deviceName">Name of the device.</param> /// <param name="remoteEndPoint">The remote end point.</param> + /// <param name="isLocal">if set to <c>true</c> [is local].</param> /// <returns>Task{SessionInfo}.</returns> Task<AuthenticationResult> AuthenticateNewSession(string username, string password, @@ -225,7 +226,8 @@ namespace MediaBrowser.Controller.Session string appVersion, string deviceId, string deviceName, - string remoteEndPoint); + string remoteEndPoint, + bool isLocal); /// <summary> /// Reports the capabilities. @@ -282,12 +284,5 @@ namespace MediaBrowser.Controller.Session /// <param name="id">The identifier.</param> /// <returns>Task.</returns> Task RevokeToken(string id); - - /// <summary> - /// Determines whether the specified remote endpoint is local. - /// </summary> - /// <param name="remoteEndpoint">The remote endpoint.</param> - /// <returns><c>true</c> if the specified remote endpoint is local; otherwise, <c>false</c>.</returns> - bool IsInLocalNetwork(string remoteEndpoint); } }
\ No newline at end of file diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index bb919edb8..baa9f933d 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -57,14 +57,30 @@ </PropertyGroup> <ItemGroup> <!-- A reference to the entire .NET Framework is automatically included --> + <None Include="app.config" /> <None Include="Fody.targets" /> <None Include="packages.config" /> </ItemGroup> <ItemGroup> + <Reference Include="Microsoft.Threading.Tasks"> + <HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net40+sl4+win8+wp71+wpa81\Microsoft.Threading.Tasks.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Threading.Tasks.Extensions"> + <HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net40+sl4+win8+wp71+wpa81\Microsoft.Threading.Tasks.Extensions.dll</HintPath> + </Reference> <Reference Include="PropertyChanged"> <HintPath>..\packages\PropertyChanged.Fody.1.41.0.0\Lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\PropertyChanged.dll</HintPath> <Private>False</Private> </Reference> + <Reference Include="System.IO"> + <HintPath>..\packages\Microsoft.Bcl.1.1.8\lib\portable-net40+sl5+win8+wp8+wpa81\System.IO.dll</HintPath> + </Reference> + <Reference Include="System.Runtime"> + <HintPath>..\packages\Microsoft.Bcl.1.1.8\lib\portable-net40+sl5+win8+wp8+wpa81\System.Runtime.dll</HintPath> + </Reference> + <Reference Include="System.Threading.Tasks"> + <HintPath>..\packages\Microsoft.Bcl.1.1.8\lib\portable-net40+sl5+win8+wp8+wpa81\System.Threading.Tasks.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\MediaBrowser.Model\ApiClient\ApiClientExtensions.cs"> @@ -914,6 +930,11 @@ xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\portable\" /y /d /r /i </PropertyGroup> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="Fody.targets" /> + <Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" /> + <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''"> + <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" /> + <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" /> + </Target> <!-- 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. <Target Name="BeforeBuild"> diff --git a/MediaBrowser.Model.Portable/app.config b/MediaBrowser.Model.Portable/app.config new file mode 100644 index 000000000..3c7378292 --- /dev/null +++ b/MediaBrowser.Model.Portable/app.config @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/MediaBrowser.Model.Portable/packages.config b/MediaBrowser.Model.Portable/packages.config index a0f393fdd..4d54d0baf 100644 --- a/MediaBrowser.Model.Portable/packages.config +++ b/MediaBrowser.Model.Portable/packages.config @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Fody" version="1.19.1.0" targetFramework="portable-win+net45+sl40+wp71" developmentDependency="true" /> + <package id="Microsoft.Bcl" version="1.1.8" targetFramework="portable-net45+sl50+win+wp80" /> + <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="portable-net45+sl50+win+wp80" /> + <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable-net45+sl50+win+wp80" /> <package id="PropertyChanged.Fody" version="1.41.0.0" targetFramework="portable-net45+sl40+wp71+win" /> </packages>
\ No newline at end of file diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 74a3314b7..80a9ec3c4 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -93,6 +93,12 @@ namespace MediaBrowser.Model.ApiClient Task ReportCapabilities(ClientCapabilities capabilities, CancellationToken cancellationToken); /// <summary> + /// Logouts this instance. + /// </summary> + /// <returns>Task.</returns> + Task Logout(); + + /// <summary> /// Gets the index of the game players. /// </summary> /// <param name="userId">The user id.</param> diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.cs index 1aae2a89c..5a9526d95 100644 --- a/MediaBrowser.Model/Entities/CollectionType.cs +++ b/MediaBrowser.Model/Entities/CollectionType.cs @@ -1,5 +1,4 @@ - -namespace MediaBrowser.Model.Entities +namespace MediaBrowser.Model.Entities { public static class CollectionType { diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs index 404c333c2..18117c100 100644 --- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -211,7 +211,7 @@ namespace MediaBrowser.Server.Implementations.Configuration } } - public void SetPreferredMetadataService(string service) + public void DisableMetadataService(string service) { DisableMetadataService(typeof(Movie), Configuration, service); DisableMetadataService(typeof(MusicAlbum), Configuration, service); diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 17118f4b4..8229c8a2f 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -14,21 +14,6 @@ namespace MediaBrowser.Server.Implementations.Library /// </summary> public class CoreResolutionIgnoreRule : IResolverIgnoreRule { - /// <summary> - /// Any folder named in this list will be ignored - can be added to at runtime for extensibility - /// </summary> - private static readonly Dictionary<string, string> IgnoreFolders = new List<string> - { - "metadata", - "ps3_update", - "ps3_vprm", - "extrafanart", - "extrathumbs", - ".actors", - ".wd_tv" - - }.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); - private readonly IFileSystem _fileSystem; public CoreResolutionIgnoreRule(IFileSystem fileSystem) @@ -78,7 +63,7 @@ namespace MediaBrowser.Server.Implementations.Library if (args.IsDirectory) { // Ignore any folders in our list - if (IgnoreFolders.ContainsKey(filename)) + if (EntityResolutionHelper.IgnoreFolders.Contains(filename, StringComparer.OrdinalIgnoreCase)) { return true; } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 905e6e676..f3e6fcdba 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -6,11 +6,11 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using MediaBrowser.Model.Logging; namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { @@ -79,29 +79,29 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { if (string.Equals(collectionType, CollectionType.Trailers, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<Trailer>(args.Path, args.Parent, args.FileSystemChildren, args.DirectoryService, false, false); + return FindMovie<Trailer>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, false); } if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren, args.DirectoryService, false, false); + return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, false); } if (string.Equals(collectionType, CollectionType.AdultVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<AdultVideo>(args.Path, args.Parent, args.FileSystemChildren, args.DirectoryService, true, false); + return FindMovie<AdultVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, false); } if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren, args.DirectoryService, true, false); + return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, false); } if (string.IsNullOrEmpty(collectionType) || string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren, args.DirectoryService, true, true); + return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, true); } return null; @@ -187,7 +187,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies /// <param name="directoryService">The directory service.</param> /// <param name="supportMultiFileItems">if set to <c>true</c> [support multi file items].</param> /// <returns>Movie.</returns> - private T FindMovie<T>(string path, Folder parent, IEnumerable<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, bool supportMultiFileItems, bool supportsMultipleSources) + private T FindMovie<T>(string path, Folder parent, List<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, bool supportMultiFileItems, bool supportsMultipleSources) where T : Video, new() { var movies = new List<T>(); diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 1d1910e40..754f63cbd 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1207,18 +1207,20 @@ namespace MediaBrowser.Server.Implementations.Session /// <param name="deviceId">The device identifier.</param> /// <param name="deviceName">Name of the device.</param> /// <param name="remoteEndPoint">The remote end point.</param> + /// <param name="isLocal">if set to <c>true</c> [is local].</param> /// <returns>Task{SessionInfo}.</returns> /// <exception cref="System.UnauthorizedAccessException">Invalid user or password entered.</exception> - /// <exception cref="UnauthorizedAccessException"></exception> + /// <exception cref="UnauthorizedAccessException">Invalid user or password entered.</exception> public async Task<AuthenticationResult> AuthenticateNewSession(string username, string password, string clientType, string appVersion, string deviceId, string deviceName, - string remoteEndPoint) + string remoteEndPoint, + bool isLocal) { - var result = (IsLocalhost(remoteEndPoint) && string.Equals(clientType, "Dashboard", StringComparison.OrdinalIgnoreCase)) || + var result = (isLocal && string.Equals(clientType, "Dashboard", StringComparison.OrdinalIgnoreCase)) || await _userManager.AuthenticateUser(username, password).ConfigureAwait(false); if (!result) @@ -1337,35 +1339,6 @@ namespace MediaBrowser.Server.Implementations.Session return Logout(token); } - private bool IsLocalhost(string remoteEndpoint) - { - if (string.IsNullOrWhiteSpace(remoteEndpoint)) - { - throw new ArgumentNullException("remoteEndpoint"); - } - - return remoteEndpoint.IndexOf("localhost", StringComparison.OrdinalIgnoreCase) != -1 || - remoteEndpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("::", StringComparison.OrdinalIgnoreCase); - } - - public bool IsInLocalNetwork(string remoteEndpoint) - { - if (string.IsNullOrWhiteSpace(remoteEndpoint)) - { - throw new ArgumentNullException("remoteEndpoint"); - } - - // Private address space: - // http://en.wikipedia.org/wiki/Private_network - - return IsLocalhost(remoteEndpoint) || - remoteEndpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("192.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("172.", StringComparison.OrdinalIgnoreCase) || - remoteEndpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase); - } - /// <summary> /// Reports the capabilities. /// </summary> diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index e6d864578..1e248ab57 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -337,7 +337,7 @@ namespace MediaBrowser.ServerApplication // Make sure xbmc metadata is disabled for existing users. // New users will be handled by the startup wizard. - ServerConfigurationManager.SetPreferredMetadataService("Media Browser Xml"); + ServerConfigurationManager.DisableMetadataService("Xbmc Nfo"); } ServerConfigurationManager.Configuration.DefaultMetadataSettingsApplied = true; diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 1df5ab37f..92f7fa355 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.415</version> + <version>3.0.418</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <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> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.415" /> + <dependency id="MediaBrowser.Common" version="3.0.418" /> <dependency id="NLog" version="2.1.0" /> <dependency id="SimpleInjector" version="2.5.0" /> <dependency id="sharpcompress" version="0.10.2" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 71bc24e34..4cb876d65 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> +<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.415</version> + <version>3.0.418</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,9 +12,11 @@ <description>Contains common model objects and interfaces used by all Media Browser solutions.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <group targetFramework=".NETFramework4.5"/> - <group targetFramework=".NETFramework3.5"/> - <group targetFramework=".NETPortable0.0-net45+sl4+wp71+win8"/> + <group targetFramework=".NETFramework4.5" /> + <group targetFramework=".NETFramework3.5" /> + <group targetFramework=".NETPortable0.0-net45+sl4+wp71+win8"> + <dependency id="Microsoft.Bcl.Async" version="1.0.168" /> + </group> </dependencies> </metadata> <files> diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index bfcdddcfb..597a29b7c 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Model.Signed</id> - <version>3.0.415</version> + <version>3.0.418</version> <title>MediaBrowser.Model - Signed Edition</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 6de3eb821..05863d47a 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.415</version> + <version>3.0.418</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.415" /> + <dependency id="MediaBrowser.Common" version="3.0.418" /> </dependencies> </metadata> <files> |
