factor mixed folder value into item id

pull/702/head
Luke Pulverenti 12 years ago
parent a78ed5c61f
commit 1df5839eb0

@ -40,17 +40,36 @@ namespace MediaBrowser.Common.Extensions
/// Gets the MB id. /// Gets the MB id.
/// </summary> /// </summary>
/// <param name="str">The STR.</param> /// <param name="str">The STR.</param>
/// <param name="aType">A type.</param> /// <param name="type">The type.</param>
/// <returns>Guid.</returns> /// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">aType</exception> public static Guid GetMBId(this string str, Type type)
public static Guid GetMBId(this string str, Type aType)
{ {
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("type");
}
var key = type.FullName + str.ToLower();
if (isInMixedFolder)
{ {
throw new ArgumentNullException("aType"); key += "InMixedFolder";
} }
return (aType.FullName + str.ToLower()).GetMD5(); return key.GetMD5();
} }
/// <summary> /// <summary>

@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.Entities
if (item.Id == Guid.Empty) 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) if (item.DateCreated == DateTime.MinValue)

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

@ -34,7 +34,7 @@ namespace MediaBrowser.Server.Implementations.Library
item.Parent = args.Parent; 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 the resolver didn't specify this
if (string.IsNullOrEmpty(item.DisplayMediaType)) if (string.IsNullOrEmpty(item.DisplayMediaType))

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

Loading…
Cancel
Save