factor mixed folder value into item id

This commit is contained in:
Luke Pulverenti 2013-08-16 16:13:45 -04:00
parent a78ed5c61f
commit 1df5839eb0
5 changed files with 34 additions and 10 deletions

View File

@ -40,17 +40,36 @@ namespace MediaBrowser.Common.Extensions
/// Gets the MB id.
/// </summary>
/// <param name="str">The STR.</param>
/// <param name="aType">A type.</param>
/// <param name="type">The type.</param>
/// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">aType</exception>
public static Guid GetMBId(this string str, Type aType)
public static Guid GetMBId(this string str, Type type)
{
if (aType == null)
return str.GetMBId(type, false);
}
/// <summary>
/// Gets the MB id.
/// </summary>
/// <param name="str">The STR.</param>
/// <param name="type">The type.</param>
/// <param name="isInMixedFolder">if set to <c>true</c> [is in mixed folder].</param>
/// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">type</exception>
public static Guid GetMBId(this string str, Type type, bool isInMixedFolder)
{
if (type == null)
{
throw new ArgumentNullException("aType");
throw new ArgumentNullException("type");
}
return (aType.FullName + str.ToLower()).GetMD5();
var key = type.FullName + str.ToLower();
if (isInMixedFolder)
{
key += "InMixedFolder";
}
return key.GetMD5();
}
/// <summary>

View File

@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.Entities
if (item.Id == Guid.Empty)
{
item.Id = item.Path.GetMBId(item.GetType());
item.Id = item.Path.GetMBId(item.GetType(), item.IsInMixedFolder);
}
if (item.DateCreated == DateTime.MinValue)

View File

@ -46,7 +46,7 @@ namespace MediaBrowser.Providers
return true;
}
return item.IsInMixedFolder && !(item is Episode);
return item.IsInMixedFolder && item.Parent != null && !(item is Episode);
}
return false;
}
@ -118,6 +118,10 @@ namespace MediaBrowser.Providers
{
if (item.IsInMixedFolder)
{
if (item.Parent == null)
{
return item.ResolveArgs;
}
return item.Parent.ResolveArgs;
}

View File

@ -34,7 +34,7 @@ namespace MediaBrowser.Server.Implementations.Library
item.Parent = args.Parent;
}
item.Id = item.Path.GetMBId(item.GetType());
item.Id = item.Path.GetMBId(item.GetType(), item.IsInMixedFolder);
// If the resolver didn't specify this
if (string.IsNullOrEmpty(item.DisplayMediaType))

View File

@ -244,6 +244,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
if (item != null)
{
item.IsInMixedFolder = false;
movies.Add(item);
}
}