aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-15 11:25:51 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-15 11:25:51 -0400
commit612b7e55d25131fc92e3bb5e035511409c97946c (patch)
treeeca6269edfca0001782fed2cded887146b9e68bc /MediaBrowser.Server.Implementations
parent80a256bdea9246ad2eb4be3a4f089631179747dc (diff)
prep work for multiple movies in folder support
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs42
-rw-r--r--MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs4
2 files changed, 28 insertions, 18 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 492e410ec..c10db1bfa 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -48,35 +48,45 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
/// <returns>Video.</returns>
protected override Video Resolve(ItemResolveArgs args)
{
- // Must be a directory
- if (args.IsDirectory)
+ // Avoid expensive tests against VF's and all their children by not allowing this
+ if (args.Parent != null)
{
- // Avoid expensive tests against VF's and all their children by not allowing this
- if (args.Parent != null)
+ if (args.Parent.IsRoot)
{
- if (args.Parent.IsRoot)
- {
- return null;
- }
+ return null;
+ }
- // If the parent is not a boxset, the only other allowed parent type is Folder
- if (!(args.Parent is BoxSet))
+ // If the parent is not a boxset, the only other allowed parent type is Folder
+ if (!(args.Parent is BoxSet))
+ {
+ if (args.Parent.GetType() != typeof(Folder))
{
- if (args.Parent.GetType() != typeof(Folder))
- {
- return null;
- }
+ return null;
}
}
+ }
+ // Since the looping is expensive, this is an optimization to help us avoid it
+ if (args.Path.IndexOf("[tvdbid", StringComparison.OrdinalIgnoreCase) != -1)
+ {
+ return null;
+ }
+
+ var isDirectory = args.IsDirectory;
+
+ if (isDirectory)
+ {
// Since the looping is expensive, this is an optimization to help us avoid it
- if (args.ContainsMetaFileByName("series.xml") || args.Path.IndexOf("[tvdbid", StringComparison.OrdinalIgnoreCase) != -1)
+ if (args.ContainsMetaFileByName("series.xml"))
{
return null;
}
+ }
- var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
+ var collectionType = args.Parent == null ? null : _libraryManager.FindCollectionType(args.Parent);
+ if (isDirectory)
+ {
if (args.Path.IndexOf("[trailers]", StringComparison.OrdinalIgnoreCase) != -1 ||
string.Equals(collectionType, CollectionType.Trailers, StringComparison.OrdinalIgnoreCase))
{
diff --git a/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs b/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs
index 51ca6d3bd..f5b5ea6c0 100644
--- a/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs
+++ b/MediaBrowser.Server.Implementations/MediaEncoder/MediaEncoder.cs
@@ -1,5 +1,4 @@
-using System.Globalization;
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Model.Entities;
@@ -10,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;