aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-07-13 00:55:56 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-07-13 00:55:56 -0400
commitbaf44b2718162c7f1d4f3061e438efbafc22201b (patch)
tree168e28a37bb4af62c195c0777703c5eae4eab72b /MediaBrowser.Server.Implementations
parent8b630e2d41697ce2ff8b93b7904d884fc96058f4 (diff)
3.0.5306.42925
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs17
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs14
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs37
4 files changed, 14 insertions, 56 deletions
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>