diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 1d360098c4..47c129dea3 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Providers;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System;
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 4e12a86861..c6f4790298 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Localization;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Entities;
using System;
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 7ba60e9214..3f19302093 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs
index e0ef188b8a..d6a922ff47 100644
--- a/MediaBrowser.Controller/Library/TVUtils.cs
+++ b/MediaBrowser.Controller/Library/TVUtils.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Controller.Library
{
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 80c44d50c4..319289f94a 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -110,7 +110,9 @@
-
+
+
+
@@ -165,9 +167,9 @@
-
-
-
+
+
+
diff --git a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs
new file mode 100644
index 0000000000..fc5157d5ff
--- /dev/null
+++ b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs
@@ -0,0 +1,61 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+
+namespace MediaBrowser.Controller.Resolvers
+{
+ ///
+ /// Class ItemResolver
+ ///
+ ///
+ public abstract class ItemResolver : IItemResolver
+ where T : BaseItem, new()
+ {
+ ///
+ /// Resolves the specified args.
+ ///
+ /// The args.
+ /// `0.
+ protected virtual T Resolve(ItemResolveArgs args)
+ {
+ return null;
+ }
+
+ ///
+ /// Gets the priority.
+ ///
+ /// The priority.
+ public virtual ResolverPriority Priority
+ {
+ get
+ {
+ return ResolverPriority.First;
+ }
+ }
+
+ ///
+ /// Sets initial values on the newly resolved item
+ ///
+ /// The item.
+ /// The args.
+ protected virtual void SetInitialItemValues(T item, ItemResolveArgs args)
+ {
+ }
+
+ ///
+ /// Resolves the path.
+ ///
+ /// The args.
+ /// BaseItem.
+ BaseItem IItemResolver.ResolvePath(ItemResolveArgs args)
+ {
+ var item = Resolve(args);
+
+ if (item != null)
+ {
+ SetInitialItemValues(item, args);
+ }
+
+ return item;
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs
new file mode 100644
index 0000000000..c2536cd604
--- /dev/null
+++ b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs
@@ -0,0 +1,56 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Entities;
+using System;
+using System.IO;
+
+namespace MediaBrowser.Controller.Resolvers
+{
+ ///
+ /// Resolves a Path into a Video or Video subclass
+ ///
+ ///
+ public abstract class BaseVideoResolver : ItemResolver
+ where T : Video, new()
+ {
+ ///
+ /// Resolves the specified args.
+ ///
+ /// The args.
+ /// `0.
+ protected override T Resolve(ItemResolveArgs args)
+ {
+ // If the path is a file check for a matching extensions
+ if (!args.IsDirectory)
+ {
+ if (EntityResolutionHelper.IsVideoFile(args.Path))
+ {
+ var extension = Path.GetExtension(args.Path);
+
+ var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
+ VideoType.Iso : VideoType.VideoFile;
+
+ return new T
+ {
+ VideoType = type,
+ Path = args.Path
+ };
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Sets the initial item values.
+ ///
+ /// The item.
+ /// The args.
+ protected override void SetInitialItemValues(T item, ItemResolveArgs args)
+ {
+ base.SetInitialItemValues(item, args);
+
+ item.VideoFormat = item.Path.IndexOf("[3d]", StringComparison.OrdinalIgnoreCase) != -1 ? VideoFormat.Digital3D : item.Path.IndexOf("[sbs3d]", StringComparison.OrdinalIgnoreCase) != -1 ? VideoFormat.Sbs3D : VideoFormat.Standard;
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Library/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
similarity index 97%
rename from MediaBrowser.Controller/Library/EntityResolutionHelper.cs
rename to MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
index 07e0b5a117..dda2af0cf5 100644
--- a/MediaBrowser.Controller/Library/EntityResolutionHelper.cs
+++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
@@ -4,8 +4,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using MediaBrowser.Controller.Library;
-namespace MediaBrowser.Controller.Library
+namespace MediaBrowser.Controller.Resolvers
{
///
/// Class EntityResolutionHelper
diff --git a/MediaBrowser.Controller/Library/IItemResolver.cs b/MediaBrowser.Controller/Resolvers/IItemResolver.cs
similarity index 86%
rename from MediaBrowser.Controller/Library/IItemResolver.cs
rename to MediaBrowser.Controller/Resolvers/IItemResolver.cs
index 721b787d31..780d5d013d 100644
--- a/MediaBrowser.Controller/Library/IItemResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/IItemResolver.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
-namespace MediaBrowser.Controller.Library
+namespace MediaBrowser.Controller.Resolvers
{
///
/// Interface IItemResolver
diff --git a/MediaBrowser.Controller/Library/IResolverIgnoreRule.cs b/MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs
similarity index 72%
rename from MediaBrowser.Controller/Library/IResolverIgnoreRule.cs
rename to MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs
index c9c6020894..e855355488 100644
--- a/MediaBrowser.Controller/Library/IResolverIgnoreRule.cs
+++ b/MediaBrowser.Controller/Resolvers/IResolverIgnoreRule.cs
@@ -1,4 +1,6 @@
-namespace MediaBrowser.Controller.Library
+using MediaBrowser.Controller.Library;
+
+namespace MediaBrowser.Controller.Resolvers
{
///
/// Provides a base "rule" that anyone can use to have paths ignored by the resolver
diff --git a/MediaBrowser.Controller/Library/ResolverPriority.cs b/MediaBrowser.Controller/Resolvers/ResolverPriority.cs
similarity index 91%
rename from MediaBrowser.Controller/Library/ResolverPriority.cs
rename to MediaBrowser.Controller/Resolvers/ResolverPriority.cs
index 1f266f3715..63a107fda6 100644
--- a/MediaBrowser.Controller/Library/ResolverPriority.cs
+++ b/MediaBrowser.Controller/Resolvers/ResolverPriority.cs
@@ -1,5 +1,5 @@
-namespace MediaBrowser.Controller.Library
+namespace MediaBrowser.Controller.Resolvers
{
///
/// Enum ResolverPriority
diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 98b8bea11c..cebd5e192a 100644
--- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library
{
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index e778b35df0..b6e9fec170 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -6,6 +6,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.ScheduledTasks;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
index aea34b0be4..f4e34ba620 100644
--- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
+++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using System.IO;
using System.Text.RegularExpressions;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
index f8e0acb5a5..42370c17fe 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Library;
using System;
using System.IO;
using System.Linq;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
index 31016e2fc8..6ca4338a41 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index e48ad96c6a..78f4b5a271 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using System.Linq;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs
index a80a48290e..a03eda263a 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs
index c680af7d6d..ebe36c16ef 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
index d0a0cd5c72..f8e9f32b5a 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
@@ -2,13 +2,14 @@
using MediaBrowser.Controller.Library;
using System;
using System.IO;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
///
/// Class LocalTrailerResolver
///
- public class LocalTrailerResolver : VideoResolver
+ public class LocalTrailerResolver : BaseVideoResolver
{
///
/// Resolves the specified args.
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 601ab66617..4dd7aceb44 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers.Movies;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
@@ -13,7 +14,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
///
/// Class MovieResolver
///
- public class MovieResolver : VideoResolver
+ public class MovieResolver : BaseVideoResolver
{
///
/// Gets the priority.
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
index 6fa9711cc6..7173705900 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
@@ -8,7 +9,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
///
/// Class EpisodeResolver
///
- public class EpisodeResolver : VideoResolver
+ public class EpisodeResolver : BaseVideoResolver
{
///
/// Resolves the specified args.
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
index 642e523638..9f78819863 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
using System.IO;
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
index 5a47f38cd2..391a3d9484 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
@@ -1,15 +1,12 @@
using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Entities;
-using System;
-using System.IO;
+using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
///
/// Resolves a Path into a Video
///
- public class VideoResolver : VideoResolver