Merge pull request #966 from MediaBrowser/dev

adjust imdb id parsing
This commit is contained in:
Luke 2015-01-04 09:37:18 -05:00
commit 15de5cbe1c
3 changed files with 29 additions and 26 deletions

View File

@ -29,13 +29,14 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
private readonly ConcurrentDictionary<Guid, ClientInfo> _apps = new ConcurrentDictionary<Guid, ClientInfo>(); private readonly ConcurrentDictionary<Guid, ClientInfo> _apps = new ConcurrentDictionary<Guid, ClientInfo>();
public UsageEntryPoint(ILogger logger, IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient, ISessionManager sessionManager) public UsageEntryPoint(ILogger logger, IApplicationHost applicationHost, INetworkManager networkManager, IHttpClient httpClient, ISessionManager sessionManager, IUserManager userManager)
{ {
_logger = logger; _logger = logger;
_applicationHost = applicationHost; _applicationHost = applicationHost;
_networkManager = networkManager; _networkManager = networkManager;
_httpClient = httpClient; _httpClient = httpClient;
_sessionManager = sessionManager; _sessionManager = sessionManager;
_userManager = userManager;
_sessionManager.SessionStarted += _sessionManager_SessionStarted; _sessionManager.SessionStarted += _sessionManager_SessionStarted;
} }

View File

@ -33,10 +33,9 @@ namespace MediaBrowser.Server.Implementations.Library
return str.Substring(start, end - start); return str.Substring(start, end - start);
} }
// for imdbid we also accept pattern matching // for imdbid we also accept pattern matching
if (attrib == "imdbid") if (string.Equals(attrib, "imdbid", StringComparison.OrdinalIgnoreCase))
{ {
Regex imdbPattern = new Regex("tt\\d{7}"); var m = Regex.Match(str, "tt\\d{7}", RegexOptions.IgnoreCase);
var m = imdbPattern.Match(str);
return m.Success ? m.Value : null; return m.Success ? m.Value : null;
} }

View File

@ -19,7 +19,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
/// </summary> /// </summary>
public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver
{ {
public MovieResolver(ILibraryManager libraryManager) : base(libraryManager) public MovieResolver(ILibraryManager libraryManager)
: base(libraryManager)
{ {
} }
@ -236,6 +237,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
private void SetProviderIdsFromPath(Video item) private void SetProviderIdsFromPath(Video item)
{
if (item is Movie || item is MusicVideo)
{ {
//we need to only look at the name of this actual item (not parents) //we need to only look at the name of this actual item (not parents)
var justName = item.IsInMixedFolder ? Path.GetFileName(item.Path) : Path.GetFileName(item.ContainingFolderPath); var justName = item.IsInMixedFolder ? Path.GetFileName(item.Path) : Path.GetFileName(item.ContainingFolderPath);
@ -255,7 +258,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{ {
item.SetProviderId(MetadataProviders.Imdb, imdbid); item.SetProviderId(MetadataProviders.Imdb, imdbid);
} }
}
} }
/// <summary> /// <summary>