diff --git a/MediaBrowser.Server.Implementations/Library/PathExtensions.cs b/MediaBrowser.Server.Implementations/Library/PathExtensions.cs
index 00bd651252..822f41da22 100644
--- a/MediaBrowser.Server.Implementations/Library/PathExtensions.cs
+++ b/MediaBrowser.Server.Implementations/Library/PathExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Text.RegularExpressions;
namespace MediaBrowser.Server.Implementations.Library
{
@@ -31,6 +32,14 @@ namespace MediaBrowser.Server.Implementations.Library
int end = str.IndexOf(']', start);
return str.Substring(start, end - start);
}
+ // for imdbid we also accept pattern matching
+ if (attrib == "imdbid")
+ {
+ Regex imdbPattern = new Regex("tt\\d{7}");
+ var m = imdbPattern.Match(str);
+ return m.Success ? m.Value : null;
+ }
+
return null;
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 276b99d3a2..285aad3a3a 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -248,24 +248,34 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
base.SetInitialItemValues(item, args);
- SetProviderIdFromPath(item);
+ SetProviderIdsFromPath(item);
}
///
/// Sets the provider id from path.
///
/// The item.
- private void SetProviderIdFromPath(Video item)
+ private void SetProviderIdsFromPath(Video item)
{
//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 id = justName.GetAttributeValue("tmdbid");
+ // check for tmdb id
+ var tmdbid = justName.GetAttributeValue("tmdbid");
- if (!string.IsNullOrEmpty(id))
+ if (!string.IsNullOrEmpty(tmdbid))
{
- item.SetProviderId(MetadataProviders.Tmdb, id);
+ item.SetProviderId(MetadataProviders.Tmdb, tmdbid);
}
+
+ // check for imdb id - we use full media path, as we can assume, that this will match in any use case (wither id in parent dir or in file name)
+ var imdbid = item.Path.GetAttributeValue("imdbid");
+
+ if (!string.IsNullOrEmpty(imdbid))
+ {
+ item.SetProviderId(MetadataProviders.Imdb, imdbid);
+ }
+
}
///