diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 47c129dea3..1d360098c4 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -3,7 +3,6 @@ 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 c6f4790298..4e12a86861 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -2,7 +2,6 @@
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/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index 09b1cec0f0..f0a696df1f 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -115,7 +115,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// Add files from the metadata folder to ResolveArgs
///
/// The args.
- internal static void AddMetadataFiles(ItemResolveArgs args)
+ public static void AddMetadataFiles(ItemResolveArgs args)
{
var folder = args.GetFileSystemEntryByName("metadata");
diff --git a/MediaBrowser.Controller/Library/EntityResolutionHelper.cs b/MediaBrowser.Controller/Library/EntityResolutionHelper.cs
new file mode 100644
index 0000000000..07e0b5a117
--- /dev/null
+++ b/MediaBrowser.Controller/Library/EntityResolutionHelper.cs
@@ -0,0 +1,97 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.IO;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace MediaBrowser.Controller.Library
+{
+ ///
+ /// Class EntityResolutionHelper
+ ///
+ public static class EntityResolutionHelper
+ {
+ ///
+ /// Any extension in this list is considered a video file - can be added to at runtime for extensibility
+ ///
+ public static List VideoFileExtensions = new List
+ {
+ ".mkv",
+ ".m2t",
+ ".m2ts",
+ ".img",
+ ".iso",
+ ".ts",
+ ".rmvb",
+ ".mov",
+ ".avi",
+ ".mpg",
+ ".mpeg",
+ ".wmv",
+ ".mp4",
+ ".divx",
+ ".dvr-ms",
+ ".wtv",
+ ".ogm",
+ ".ogv",
+ ".asf",
+ ".m4v",
+ ".flv",
+ ".f4v",
+ ".3gp",
+ ".webm"
+ };
+
+ ///
+ /// Determines whether [is video file] [the specified path].
+ ///
+ /// The path.
+ /// true if [is video file] [the specified path]; otherwise, false.
+ public static bool IsVideoFile(string path)
+ {
+ var extension = Path.GetExtension(path) ?? string.Empty;
+ return VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
+ }
+
+ ///
+ /// Ensures DateCreated and DateModified have values
+ ///
+ /// The item.
+ /// The args.
+ public static void EnsureDates(BaseItem item, ItemResolveArgs args)
+ {
+ if (!Path.IsPathRooted(item.Path))
+ {
+ return;
+ }
+
+ // See if a different path came out of the resolver than what went in
+ if (!args.Path.Equals(item.Path, StringComparison.OrdinalIgnoreCase))
+ {
+ var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null;
+
+ if (childData.HasValue)
+ {
+ item.DateCreated = childData.Value.CreationTimeUtc;
+ item.DateModified = childData.Value.LastWriteTimeUtc;
+ }
+ else
+ {
+ var fileData = FileSystem.GetFileData(item.Path);
+
+ if (fileData.HasValue)
+ {
+ item.DateCreated = fileData.Value.CreationTimeUtc;
+ item.DateModified = fileData.Value.LastWriteTimeUtc;
+ }
+ }
+ }
+ else
+ {
+ item.DateCreated = args.FileInfo.CreationTimeUtc;
+ item.DateModified = args.FileInfo.LastWriteTimeUtc;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Library/IItemResolver.cs b/MediaBrowser.Controller/Library/IItemResolver.cs
new file mode 100644
index 0000000000..721b787d31
--- /dev/null
+++ b/MediaBrowser.Controller/Library/IItemResolver.cs
@@ -0,0 +1,22 @@
+using MediaBrowser.Controller.Entities;
+
+namespace MediaBrowser.Controller.Library
+{
+ ///
+ /// Interface IItemResolver
+ ///
+ public interface IItemResolver
+ {
+ ///
+ /// Resolves the path.
+ ///
+ /// The args.
+ /// BaseItem.
+ BaseItem ResolvePath(ItemResolveArgs args);
+ ///
+ /// Gets the priority.
+ ///
+ /// The priority.
+ ResolverPriority Priority { get; }
+ }
+}
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 64070cb834..7ba60e9214 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.IO;
-using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
@@ -158,7 +157,7 @@ namespace MediaBrowser.Controller.Library
/// The plugin folders.
/// The resolvers.
/// The intro providers.
- void AddParts(IEnumerable rules, IEnumerable pluginFolders,
- IEnumerable resolvers, IEnumerable introProviders);
+ void AddParts(IEnumerable rules, IEnumerable pluginFolders,
+ IEnumerable resolvers, IEnumerable introProviders);
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Controller/Resolvers/IResolutionIgnoreRule.cs b/MediaBrowser.Controller/Library/IResolverIgnoreRule.cs
similarity index 59%
rename from MediaBrowser.Controller/Resolvers/IResolutionIgnoreRule.cs
rename to MediaBrowser.Controller/Library/IResolverIgnoreRule.cs
index 661688f3c7..c9c6020894 100644
--- a/MediaBrowser.Controller/Resolvers/IResolutionIgnoreRule.cs
+++ b/MediaBrowser.Controller/Library/IResolverIgnoreRule.cs
@@ -1,11 +1,9 @@
-using MediaBrowser.Controller.Library;
-
-namespace MediaBrowser.Controller.Resolvers
+namespace MediaBrowser.Controller.Library
{
///
/// Provides a base "rule" that anyone can use to have paths ignored by the resolver
///
- public interface IResolutionIgnoreRule
+ public interface IResolverIgnoreRule
{
bool ShouldIgnore(ItemResolveArgs args);
}
diff --git a/MediaBrowser.Controller/Library/ResolverPriority.cs b/MediaBrowser.Controller/Library/ResolverPriority.cs
new file mode 100644
index 0000000000..1f266f3715
--- /dev/null
+++ b/MediaBrowser.Controller/Library/ResolverPriority.cs
@@ -0,0 +1,26 @@
+
+namespace MediaBrowser.Controller.Library
+{
+ ///
+ /// Enum ResolverPriority
+ ///
+ public enum ResolverPriority
+ {
+ ///
+ /// The first
+ ///
+ First = 1,
+ ///
+ /// The second
+ ///
+ Second = 2,
+ ///
+ /// The third
+ ///
+ Third = 3,
+ ///
+ /// The last
+ ///
+ Last = 4
+ }
+}
diff --git a/MediaBrowser.Controller/Resolvers/TV/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs
similarity index 99%
rename from MediaBrowser.Controller/Resolvers/TV/TVUtils.cs
rename to MediaBrowser.Controller/Library/TVUtils.cs
index dddccaff9c..e0ef188b8a 100644
--- a/MediaBrowser.Controller/Resolvers/TV/TVUtils.cs
+++ b/MediaBrowser.Controller/Library/TVUtils.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
-namespace MediaBrowser.Controller.Resolvers.TV
+namespace MediaBrowser.Controller.Library
{
///
/// Class TVUtils
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 63468a8e80..839cf2f404 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -110,6 +110,7 @@
+
@@ -163,18 +164,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -187,10 +180,6 @@
-
-
-
-
diff --git a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs
index 2622e50ee2..8056ea5c0f 100644
--- a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs
+++ b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Extensions;
-using MediaBrowser.Controller.Resolvers.TV;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs
index fa92cbe99d..ac79817754 100644
--- a/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs
+++ b/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
-using MediaBrowser.Controller.Resolvers.TV;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs
index c22b494e49..7c65136b61 100644
--- a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs
+++ b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Extensions;
-using MediaBrowser.Controller.Resolvers.TV;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
diff --git a/MediaBrowser.Controller/Providers/TV/SeriesXmlParser.cs b/MediaBrowser.Controller/Providers/TV/SeriesXmlParser.cs
index 2822a43b29..f63a47627e 100644
--- a/MediaBrowser.Controller/Providers/TV/SeriesXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/TV/SeriesXmlParser.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Entities.TV;
-using MediaBrowser.Controller.Resolvers.TV;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System;
diff --git a/MediaBrowser.Controller/Resolvers/Audio/AudioResolver.cs b/MediaBrowser.Controller/Resolvers/Audio/AudioResolver.cs
deleted file mode 100644
index 6e1bbfbfe3..0000000000
--- a/MediaBrowser.Controller/Resolvers/Audio/AudioResolver.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using MediaBrowser.Controller.Library;
-
-namespace MediaBrowser.Controller.Resolvers.Audio
-{
- ///
- /// Class AudioResolver
- ///
- public class AudioResolver : BaseItemResolver
- {
- ///
- /// Gets the priority.
- ///
- /// The priority.
- public override ResolverPriority Priority
- {
- get { return ResolverPriority.Last; }
- }
-
- ///
- /// Resolves the specified args.
- ///
- /// The args.
- /// Entities.Audio.Audio.
- protected override Entities.Audio.Audio Resolve(ItemResolveArgs args)
- {
- // Return audio if the path is a file and has a matching extension
-
- if (!args.IsDirectory)
- {
- if (EntityResolutionHelper.IsAudioFile(args))
- {
- return new Entities.Audio.Audio();
- }
- }
-
- return null;
- }
- }
-}
diff --git a/MediaBrowser.Controller/Resolvers/Audio/MusicAlbumResolver.cs b/MediaBrowser.Controller/Resolvers/Audio/MusicAlbumResolver.cs
deleted file mode 100644
index d8d2c326d8..0000000000
--- a/MediaBrowser.Controller/Resolvers/Audio/MusicAlbumResolver.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using MediaBrowser.Controller.Entities.Audio;
-using MediaBrowser.Controller.Library;
-
-namespace MediaBrowser.Controller.Resolvers.Audio
-{
- ///
- /// Class MusicAlbumResolver
- ///
- public class MusicAlbumResolver : BaseItemResolver
- {
- ///
- /// Gets the priority.
- ///
- /// The priority.
- public override ResolverPriority Priority
- {
- get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
- }
-
- ///
- /// Resolves the specified args.
- ///
- /// The args.
- /// MusicAlbum.
- protected override MusicAlbum Resolve(ItemResolveArgs args)
- {
- if (!args.IsDirectory) return null;
-
- //Avoid mis-identifying top folders
- if (args.Parent == null) return null;
- if (args.Parent.IsRoot) return null;
-
- return EntityResolutionHelper.IsMusicAlbum(args) ? new MusicAlbum() : null;
- }
-
- }
-}
diff --git a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs
deleted file mode 100644
index 8e43a791fc..0000000000
--- a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using System.IO;
-using System.Text.RegularExpressions;
-
-namespace MediaBrowser.Controller.Resolvers
-{
- ///
- /// Class BaseItemResolver
- ///
- ///
- public abstract class BaseItemResolver : IBaseItemResolver
- 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)
- {
- // If the subclass didn't specify this
- if (string.IsNullOrEmpty(item.Path))
- {
- item.Path = args.Path;
- }
-
- // If the subclass didn't specify this
- if (args.Parent != null)
- {
- item.Parent = args.Parent;
- }
-
- item.Id = item.Path.GetMBId(item.GetType());
- item.DisplayMediaType = item.GetType().Name;
- }
-
- ///
- /// Resolves the path.
- ///
- /// The args.
- /// BaseItem.
- public BaseItem ResolvePath(ItemResolveArgs args)
- {
- T item = Resolve(args);
-
- if (item != null)
- {
- // Set the args on the item
- item.ResolveArgs = args;
-
- // Set initial values on the newly resolved item
- SetInitialItemValues(item, args);
-
- // Make sure the item has a name
- EnsureName(item);
-
- // Make sure DateCreated and DateModified have values
- EntityResolutionHelper.EnsureDates(item, args);
- }
-
- return item;
- }
-
- ///
- /// Ensures the name.
- ///
- /// The item.
- private void EnsureName(T item)
- {
- // If the subclass didn't supply a name, add it here
- if (string.IsNullOrEmpty(item.Name) && !string.IsNullOrEmpty(item.Path))
- {
- //we use our resolve args name here to get the name of the containg folder, not actual video file
- item.Name = GetMBName(item.ResolveArgs.FileInfo.cFileName, item.ResolveArgs.FileInfo.IsDirectory);
- }
- }
-
- ///
- /// The MB name regex
- ///
- private static readonly Regex MBNameRegex = new Regex("(\\[.*\\])", RegexOptions.Compiled);
-
- ///
- /// Strip out attribute items and return just the name we will use for items
- ///
- /// Assumed to be a file or directory path
- /// if set to true [is directory].
- /// The cleaned name
- private static string GetMBName(string path, bool isDirectory)
- {
- //first just get the file or directory name
- var fn = isDirectory ? Path.GetFileName(path) : Path.GetFileNameWithoutExtension(path);
-
- //now - strip out anything inside brackets
- fn = MBNameRegex.Replace(fn, string.Empty);
-
- return fn;
- }
- }
-
- ///
- /// Weed this to keep a list of resolvers, since Resolvers are built with generics
- ///
- public interface IBaseItemResolver
- {
- ///
- /// Resolves the path.
- ///
- /// The args.
- /// BaseItem.
- BaseItem ResolvePath(ItemResolveArgs args);
- ///
- /// Gets the priority.
- ///
- /// The priority.
- ResolverPriority Priority { get; }
- }
-
- ///
- /// Enum ResolverPriority
- ///
- public enum ResolverPriority
- {
- ///
- /// The first
- ///
- First = 1,
- ///
- /// The second
- ///
- Second = 2,
- ///
- /// The third
- ///
- Third = 3,
- ///
- /// The last
- ///
- Last = 4
- }
-}
diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
deleted file mode 100644
index 6488d5ef84..0000000000
--- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.IO;
-using MediaBrowser.Controller.Library;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace MediaBrowser.Controller.Resolvers
-{
- ///
- /// Class EntityResolutionHelper
- ///
- public static class EntityResolutionHelper
- {
- ///
- /// Any extension in this list is considered a metadata file - can be added to at runtime for extensibility
- ///
- public static List MetaExtensions = new List
- {
- ".xml",
- ".jpg",
- ".png",
- ".json",
- ".data"
- };
- ///
- /// Any extension in this list is considered a video file - can be added to at runtime for extensibility
- ///
- public static List VideoFileExtensions = new List
- {
- ".mkv",
- ".m2t",
- ".m2ts",
- ".img",
- ".iso",
- ".ts",
- ".rmvb",
- ".mov",
- ".avi",
- ".mpg",
- ".mpeg",
- ".wmv",
- ".mp4",
- ".divx",
- ".dvr-ms",
- ".wtv",
- ".ogm",
- ".ogv",
- ".asf",
- ".m4v",
- ".flv",
- ".f4v",
- ".3gp",
- ".webm"
- };
-
- ///
- /// Determines whether [is video file] [the specified path].
- ///
- /// The path.
- /// true if [is video file] [the specified path]; otherwise, false.
- public static bool IsVideoFile(string path)
- {
- var extension = Path.GetExtension(path) ?? string.Empty;
- return VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
- }
-
- ///
- /// The audio file extensions
- ///
- public static readonly string[] AudioFileExtensions = new[] {
- ".mp3",
- ".flac",
- ".wma",
- ".aac",
- ".acc",
- ".m4a",
- ".m4b",
- ".wav",
- ".ape",
- ".ogg",
- ".oga"
- };
-
- ///
- /// Determines whether [is audio file] [the specified args].
- ///
- /// The args.
- /// true if [is audio file] [the specified args]; otherwise, false.
- public static bool IsAudioFile(ItemResolveArgs args)
- {
- return AudioFileExtensions.Contains(Path.GetExtension(args.Path), StringComparer.OrdinalIgnoreCase);
- }
-
- ///
- /// Determines whether [is audio file] [the specified file].
- ///
- /// The file.
- /// true if [is audio file] [the specified file]; otherwise, false.
- public static bool IsAudioFile(WIN32_FIND_DATA file)
- {
- return AudioFileExtensions.Contains(Path.GetExtension(file.Path), StringComparer.OrdinalIgnoreCase);
- }
-
- ///
- /// Determine if the supplied file data points to a music album
- ///
- /// The data.
- /// true if [is music album] [the specified data]; otherwise, false.
- public static bool IsMusicAlbum(WIN32_FIND_DATA data)
- {
- return ContainsMusic(FileSystem.GetFiles(data.Path));
- }
-
- ///
- /// Determine if the supplied reslove args should be considered a music album
- ///
- /// The args.
- /// true if [is music album] [the specified args]; otherwise, false.
- public static bool IsMusicAlbum(ItemResolveArgs args)
- {
- // Args points to an album if parent is an Artist folder or it directly contains music
- if (args.IsDirectory)
- {
- //if (args.Parent is MusicArtist) return true; //saves us from testing children twice
- if (ContainsMusic(args.FileSystemChildren)) return true;
- }
-
-
- return false;
- }
-
- ///
- /// Determine if the supplied list contains what we should consider music
- ///
- /// The list.
- /// true if the specified list contains music; otherwise, false.
- public static bool ContainsMusic(IEnumerable list)
- {
- // If list contains at least 2 audio files or at least one and no video files consider it to contain music
- var foundAudio = 0;
- var foundVideo = 0;
- foreach (var file in list)
- {
- if (IsAudioFile(file)) foundAudio++;
- if (foundAudio >= 2)
- {
- return true;
- }
- if (IsVideoFile(file.Path)) foundVideo++;
- }
-
- // or a single audio file and no video files
- if (foundAudio > 0 && foundVideo == 0) return true;
- return false;
- }
-
- ///
- /// Determines whether a path should be ignored based on its contents - called after the contents have been read
- ///
- /// The args.
- /// true if XXXX, false otherwise
- public static bool ShouldResolvePathContents(ItemResolveArgs args)
- {
- // Ignore any folders containing a file called .ignore
- return !args.ContainsFileSystemEntryByName(".ignore");
- }
-
- ///
- /// Ensures DateCreated and DateModified have values
- ///
- /// The item.
- /// The args.
- public static void EnsureDates(BaseItem item, ItemResolveArgs args)
- {
- if (!Path.IsPathRooted(item.Path))
- {
- return;
- }
-
- // See if a different path came out of the resolver than what went in
- if (!args.Path.Equals(item.Path, StringComparison.OrdinalIgnoreCase))
- {
- var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null;
-
- if (childData.HasValue)
- {
- item.DateCreated = childData.Value.CreationTimeUtc;
- item.DateModified = childData.Value.LastWriteTimeUtc;
- }
- else
- {
- var fileData = FileSystem.GetFileData(item.Path);
-
- if (fileData.HasValue)
- {
- item.DateCreated = fileData.Value.CreationTimeUtc;
- item.DateModified = fileData.Value.LastWriteTimeUtc;
- }
- }
- }
- else
- {
- item.DateCreated = args.FileInfo.CreationTimeUtc;
- item.DateModified = args.FileInfo.LastWriteTimeUtc;
- }
- }
- }
-}
diff --git a/MediaBrowser.Controller/Resolvers/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
similarity index 92%
rename from MediaBrowser.Controller/Resolvers/CoreResolutionIgnoreRule.cs
rename to MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 770b673a51..98b8bea11c 100644
--- a/MediaBrowser.Controller/Resolvers/CoreResolutionIgnoreRule.cs
+++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -3,12 +3,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace MediaBrowser.Controller.Resolvers
+namespace MediaBrowser.Server.Implementations.Library
{
///
/// Provides the core resolver ignore rules
///
- public class CoreResolutionIgnoreRule : IResolutionIgnoreRule
+ public class CoreResolutionIgnoreRule : IResolverIgnoreRule
{
///
/// Any folder named in this list will be ignored - can be added to at runtime for extensibility
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index ba54b5d2b4..e778b35df0 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -6,10 +6,10 @@ 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;
+using MediaBrowser.Server.Implementations.Library.Resolvers;
using MoreLinq;
using System;
using System.Collections.Concurrent;
@@ -37,7 +37,7 @@ namespace MediaBrowser.Server.Implementations.Library
/// Gets the list of entity resolution ignore rules
///
/// The entity resolution ignore rules.
- private IEnumerable EntityResolutionIgnoreRules { get; set; }
+ private IEnumerable EntityResolutionIgnoreRules { get; set; }
///
/// Gets the list of BasePluginFolders added by plugins
@@ -49,7 +49,7 @@ namespace MediaBrowser.Server.Implementations.Library
/// Gets the list of currently registered entity resolvers
///
/// The entity resolvers enumerable.
- private IEnumerable EntityResolvers { get; set; }
+ private IEnumerable EntityResolvers { get; set; }
#region LibraryChanged Event
///
@@ -113,7 +113,7 @@ namespace MediaBrowser.Server.Implementations.Library
/// The plugin folders.
/// The resolvers.
/// The intro providers.
- public void AddParts(IEnumerable rules, IEnumerable pluginFolders, IEnumerable resolvers, IEnumerable introProviders)
+ public void AddParts(IEnumerable rules, IEnumerable pluginFolders, IEnumerable resolvers, IEnumerable introProviders)
{
EntityResolutionIgnoreRules = rules;
PluginFolderCreators = pluginFolders;
@@ -189,7 +189,14 @@ namespace MediaBrowser.Server.Implementations.Library
/// BaseItem.
public BaseItem ResolveItem(ItemResolveArgs args)
{
- return EntityResolvers.Select(r => r.ResolvePath(args)).FirstOrDefault(i => i != null);
+ var item = EntityResolvers.Select(r => r.ResolvePath(args)).FirstOrDefault(i => i != null);
+
+ if (item != null)
+ {
+ ResolverHelper.SetInitialItemValues(item, args);
+ }
+
+ return item;
}
///
@@ -237,7 +244,7 @@ namespace MediaBrowser.Server.Implementations.Library
}
// Check to see if we should resolve based on our contents
- if (args.IsDirectory && !EntityResolutionHelper.ShouldResolvePathContents(args))
+ if (args.IsDirectory && !ShouldResolvePathContents(args))
{
return null;
}
@@ -245,6 +252,17 @@ namespace MediaBrowser.Server.Implementations.Library
return ResolveItem(args);
}
+ ///
+ /// Determines whether a path should be ignored based on its contents - called after the contents have been read
+ ///
+ /// The args.
+ /// true if XXXX, false otherwise
+ private static bool ShouldResolvePathContents(ItemResolveArgs args)
+ {
+ // Ignore any folders containing a file called .ignore
+ return !args.ContainsFileSystemEntryByName(".ignore");
+ }
+
///
/// Resolves a set of files into a list of BaseItem
///
diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
new file mode 100644
index 0000000000..aea34b0be4
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
@@ -0,0 +1,82 @@
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace MediaBrowser.Server.Implementations.Library
+{
+ ///
+ /// Class ResolverHelper
+ ///
+ public static class ResolverHelper
+ {
+ ///
+ /// Sets the initial item values.
+ ///
+ /// The item.
+ /// The args.
+ public static void SetInitialItemValues(BaseItem item, ItemResolveArgs args)
+ {
+ item.ResolveArgs = args;
+
+ // If the resolver didn't specify this
+ if (string.IsNullOrEmpty(item.Path))
+ {
+ item.Path = args.Path;
+ }
+
+ // If the resolver didn't specify this
+ if (args.Parent != null)
+ {
+ item.Parent = args.Parent;
+ }
+
+ item.Id = item.Path.GetMBId(item.GetType());
+ item.DisplayMediaType = item.GetType().Name;
+
+ // Make sure the item has a name
+ EnsureName(item);
+
+ // Make sure DateCreated and DateModified have values
+ EntityResolutionHelper.EnsureDates(item, args);
+ }
+
+ ///
+ /// Ensures the name.
+ ///
+ /// The item.
+ private static void EnsureName(BaseItem item)
+ {
+ // If the subclass didn't supply a name, add it here
+ if (string.IsNullOrEmpty(item.Name) && !string.IsNullOrEmpty(item.Path))
+ {
+ //we use our resolve args name here to get the name of the containg folder, not actual video file
+ item.Name = GetMBName(item.ResolveArgs.FileInfo.cFileName, item.ResolveArgs.FileInfo.IsDirectory);
+ }
+ }
+
+ ///
+ /// The MB name regex
+ ///
+ private static readonly Regex MBNameRegex = new Regex("(\\[.*\\])", RegexOptions.Compiled);
+
+ ///
+ /// Strip out attribute items and return just the name we will use for items
+ ///
+ /// Assumed to be a file or directory path
+ /// if set to true [is directory].
+ /// The cleaned name
+ private static string GetMBName(string path, bool isDirectory)
+ {
+ //first just get the file or directory name
+ var fn = isDirectory ? Path.GetFileName(path) : Path.GetFileNameWithoutExtension(path);
+
+ //now - strip out anything inside brackets
+ fn = MBNameRegex.Replace(fn, string.Empty);
+
+ return fn;
+ }
+
+ }
+}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
new file mode 100644
index 0000000000..f8e0acb5a5
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
@@ -0,0 +1,80 @@
+using MediaBrowser.Controller.IO;
+using MediaBrowser.Controller.Library;
+using System;
+using System.IO;
+using System.Linq;
+
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
+{
+ ///
+ /// Class AudioResolver
+ ///
+ public class AudioResolver : ItemResolver
+ {
+ ///
+ /// Gets the priority.
+ ///
+ /// The priority.
+ public override ResolverPriority Priority
+ {
+ get { return ResolverPriority.Last; }
+ }
+
+ ///
+ /// Resolves the specified args.
+ ///
+ /// The args.
+ /// Entities.Audio.Audio.
+ protected override Controller.Entities.Audio.Audio Resolve(ItemResolveArgs args)
+ {
+ // Return audio if the path is a file and has a matching extension
+
+ if (!args.IsDirectory)
+ {
+ if (IsAudioFile(args))
+ {
+ return new Controller.Entities.Audio.Audio();
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// The audio file extensions
+ ///
+ public static readonly string[] AudioFileExtensions = new[] {
+ ".mp3",
+ ".flac",
+ ".wma",
+ ".aac",
+ ".acc",
+ ".m4a",
+ ".m4b",
+ ".wav",
+ ".ape",
+ ".ogg",
+ ".oga"
+ };
+
+ ///
+ /// Determines whether [is audio file] [the specified args].
+ ///
+ /// The args.
+ /// true if [is audio file] [the specified args]; otherwise, false.
+ public static bool IsAudioFile(ItemResolveArgs args)
+ {
+ return AudioFileExtensions.Contains(Path.GetExtension(args.Path), StringComparer.OrdinalIgnoreCase);
+ }
+
+ ///
+ /// Determines whether [is audio file] [the specified file].
+ ///
+ /// The file.
+ /// true if [is audio file] [the specified file]; otherwise, false.
+ public static bool IsAudioFile(WIN32_FIND_DATA file)
+ {
+ return AudioFileExtensions.Contains(Path.GetExtension(file.Path), StringComparer.OrdinalIgnoreCase);
+ }
+ }
+}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
new file mode 100644
index 0000000000..31016e2fc8
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -0,0 +1,92 @@
+using System.Collections.Generic;
+using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.IO;
+using MediaBrowser.Controller.Library;
+
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
+{
+ ///
+ /// Class MusicAlbumResolver
+ ///
+ public class MusicAlbumResolver : ItemResolver
+ {
+ ///
+ /// Gets the priority.
+ ///
+ /// The priority.
+ public override ResolverPriority Priority
+ {
+ get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
+ }
+
+ ///
+ /// Resolves the specified args.
+ ///
+ /// The args.
+ /// MusicAlbum.
+ protected override MusicAlbum Resolve(ItemResolveArgs args)
+ {
+ if (!args.IsDirectory) return null;
+
+ //Avoid mis-identifying top folders
+ if (args.Parent == null) return null;
+ if (args.Parent.IsRoot) return null;
+
+ return IsMusicAlbum(args) ? new MusicAlbum() : null;
+ }
+
+
+ ///
+ /// Determine if the supplied file data points to a music album
+ ///
+ /// The data.
+ /// true if [is music album] [the specified data]; otherwise, false.
+ public static bool IsMusicAlbum(WIN32_FIND_DATA data)
+ {
+ return ContainsMusic(FileSystem.GetFiles(data.Path));
+ }
+
+ ///
+ /// Determine if the supplied reslove args should be considered a music album
+ ///
+ /// The args.
+ /// true if [is music album] [the specified args]; otherwise, false.
+ public static bool IsMusicAlbum(ItemResolveArgs args)
+ {
+ // Args points to an album if parent is an Artist folder or it directly contains music
+ if (args.IsDirectory)
+ {
+ //if (args.Parent is MusicArtist) return true; //saves us from testing children twice
+ if (ContainsMusic(args.FileSystemChildren)) return true;
+ }
+
+
+ return false;
+ }
+
+ ///
+ /// Determine if the supplied list contains what we should consider music
+ ///
+ /// The list.
+ /// true if the specified list contains music; otherwise, false.
+ public static bool ContainsMusic(IEnumerable list)
+ {
+ // If list contains at least 2 audio files or at least one and no video files consider it to contain music
+ var foundAudio = 0;
+ var foundVideo = 0;
+ foreach (var file in list)
+ {
+ if (AudioResolver.IsAudioFile(file)) foundAudio++;
+ if (foundAudio >= 2)
+ {
+ return true;
+ }
+ if (EntityResolutionHelper.IsVideoFile(file.Path)) foundVideo++;
+ }
+
+ // or a single audio file and no video files
+ if (foundAudio > 0 && foundVideo == 0) return true;
+ return false;
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Resolvers/Audio/MusicArtistResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
similarity index 81%
rename from MediaBrowser.Controller/Resolvers/Audio/MusicArtistResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index 45f96d3aba..e48ad96c6a 100644
--- a/MediaBrowser.Controller/Resolvers/Audio/MusicArtistResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -2,12 +2,12 @@
using MediaBrowser.Controller.Library;
using System.Linq;
-namespace MediaBrowser.Controller.Resolvers.Audio
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{
///
/// Class MusicArtistResolver
///
- public class MusicArtistResolver : BaseItemResolver
+ public class MusicArtistResolver : ItemResolver
{
///
/// Gets the priority.
@@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Resolvers.Audio
if (args.Parent.IsRoot) return null;
// If we contain an album assume we are an artist folder
- return args.FileSystemChildren.Any(EntityResolutionHelper.IsMusicAlbum) ? new MusicArtist() : null;
+ return args.FileSystemChildren.Any(MusicAlbumResolver.IsMusicAlbum) ? new MusicArtist() : null;
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs
new file mode 100644
index 0000000000..a80a48290e
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs
@@ -0,0 +1,61 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+
+namespace MediaBrowser.Server.Implementations.Library.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/FolderResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs
similarity index 88%
rename from MediaBrowser.Controller/Resolvers/FolderResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs
index c356b8c844..c680af7d6d 100644
--- a/MediaBrowser.Controller/Resolvers/FolderResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/FolderResolver.cs
@@ -1,12 +1,12 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
-namespace MediaBrowser.Controller.Resolvers
+namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
///
/// Class FolderResolver
///
- public class FolderResolver : BaseFolderResolver
+ public class FolderResolver : FolderResolver
{
///
/// Gets the priority.
@@ -47,10 +47,10 @@ namespace MediaBrowser.Controller.Resolvers
}
///
- /// Class BaseFolderResolver
+ /// Class FolderResolver
///
/// The type of the T item type.
- public abstract class BaseFolderResolver : BaseItemResolver
+ public abstract class FolderResolver : ItemResolver
where TItemType : Folder, new()
{
///
diff --git a/MediaBrowser.Controller/Resolvers/LocalTrailerResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
similarity index 89%
rename from MediaBrowser.Controller/Resolvers/LocalTrailerResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
index a61e010b3c..d0a0cd5c72 100644
--- a/MediaBrowser.Controller/Resolvers/LocalTrailerResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/LocalTrailerResolver.cs
@@ -3,12 +3,12 @@ using MediaBrowser.Controller.Library;
using System;
using System.IO;
-namespace MediaBrowser.Controller.Resolvers
+namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
///
/// Class LocalTrailerResolver
///
- public class LocalTrailerResolver : BaseVideoResolver
+ public class LocalTrailerResolver : VideoResolver
{
///
/// Resolves the specified args.
diff --git a/MediaBrowser.Controller/Resolvers/Movies/BoxSetResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
similarity index 89%
rename from MediaBrowser.Controller/Resolvers/Movies/BoxSetResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
index 2eee2a98bb..2f810d2a1f 100644
--- a/MediaBrowser.Controller/Resolvers/Movies/BoxSetResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
@@ -3,12 +3,12 @@ using MediaBrowser.Controller.Library;
using System;
using System.IO;
-namespace MediaBrowser.Controller.Resolvers.Movies
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
///
/// Class BoxSetResolver
///
- public class BoxSetResolver : BaseFolderResolver
+ public class BoxSetResolver : FolderResolver
{
///
/// Resolves the specified args.
diff --git a/MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
similarity index 97%
rename from MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 9443221a3f..601ab66617 100644
--- a/MediaBrowser.Controller/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -8,12 +8,12 @@ using System;
using System.Collections.Generic;
using System.IO;
-namespace MediaBrowser.Controller.Resolvers.Movies
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
///
/// Class MovieResolver
///
- public class MovieResolver : BaseVideoResolver
+ public class MovieResolver : VideoResolver
{
///
/// Gets the priority.
@@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Resolvers.Movies
private void SetProviderIdFromPath(Movie item)
{
//we need to only look at the name of this actual item (not parents)
- var justName = item.Path.Substring(item.Path.LastIndexOf(Path.DirectorySeparatorChar));
+ var justName = Path.GetFileName(item.Path);
var id = justName.GetAttributeValue("tmdbid");
diff --git a/MediaBrowser.Controller/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
similarity index 95%
rename from MediaBrowser.Controller/Resolvers/TV/EpisodeResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
index d1789bcbb5..6fa9711cc6 100644
--- a/MediaBrowser.Controller/Resolvers/TV/EpisodeResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
@@ -3,12 +3,12 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using System;
-namespace MediaBrowser.Controller.Resolvers.TV
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
{
///
/// Class EpisodeResolver
///
- public class EpisodeResolver : BaseVideoResolver
+ public class EpisodeResolver : VideoResolver
{
///
/// Resolves the specified args.
diff --git a/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
similarity index 90%
rename from MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
index 9ea4742079..07fb2f4864 100644
--- a/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
@@ -2,12 +2,12 @@
using MediaBrowser.Controller.Library;
using System;
-namespace MediaBrowser.Controller.Resolvers.TV
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
{
///
/// Class SeasonResolver
///
- public class SeasonResolver : BaseFolderResolver
+ public class SeasonResolver : FolderResolver
{
///
/// Resolves the specified args.
diff --git a/MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
similarity index 90%
rename from MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
index c973cfe874..642e523638 100644
--- a/MediaBrowser.Controller/Resolvers/TV/SeriesResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
@@ -5,12 +5,12 @@ using MediaBrowser.Model.Entities;
using System;
using System.IO;
-namespace MediaBrowser.Controller.Resolvers.TV
+namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
{
///
/// Class SeriesResolver
///
- public class SeriesResolver : BaseFolderResolver
+ public class SeriesResolver : FolderResolver
{
///
/// Gets the priority.
@@ -76,16 +76,16 @@ namespace MediaBrowser.Controller.Resolvers.TV
Season.AddMetadataFiles(args);
- SetProviderIdFromPath(item);
+ SetProviderIdFromPath(item, args.Path);
}
///
/// Sets the provider id from path.
///
/// The item.
- private void SetProviderIdFromPath(Series item)
+ private void SetProviderIdFromPath(Series item, string path)
{
- var justName = item.Path.Substring(item.Path.LastIndexOf(Path.DirectorySeparatorChar));
+ var justName = Path.GetFileName(path);
var id = justName.GetAttributeValue("tvdbid");
diff --git a/MediaBrowser.Controller/Resolvers/VideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
similarity index 92%
rename from MediaBrowser.Controller/Resolvers/VideoResolver.cs
rename to MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
index 5f2f8d9544..5a47f38cd2 100644
--- a/MediaBrowser.Controller/Resolvers/VideoResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs
@@ -4,12 +4,12 @@ using MediaBrowser.Model.Entities;
using System;
using System.IO;
-namespace MediaBrowser.Controller.Resolvers
+namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
///
/// Resolves a Path into a Video
///
- public class VideoResolver : BaseVideoResolver