fixes #383 - boxsets seem to ignore tmdbid tag in file path

This commit is contained in:
Luke Pulverenti 2013-07-07 19:31:54 -04:00
parent 02bb0fb20f
commit 6992d31155
2 changed files with 34 additions and 3 deletions

View File

@ -1,7 +1,10 @@
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using System;
using System.IO;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
@ -37,5 +40,34 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
return null;
}
/// <summary>
/// Sets the initial item values.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="args">The args.</param>
protected override void SetInitialItemValues(BoxSet item, ItemResolveArgs args)
{
base.SetInitialItemValues(item, args);
SetProviderIdFromPath(item);
}
/// <summary>
/// Sets the provider id from path.
/// </summary>
/// <param name="item">The item.</param>
private void SetProviderIdFromPath(BaseItem item)
{
//we need to only look at the name of this actual item (not parents)
var justName = Path.GetFileName(item.Path);
var id = justName.GetAttributeValue("tmdbid");
if (!string.IsNullOrEmpty(id))
{
item.SetProviderId(MetadataProviders.Tmdb, id);
}
}
}
}

View File

@ -74,8 +74,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
}
// A shortcut to help us resolve faster in some cases
var isKnownMovie = args.ContainsMetaFileByName("movie.xml") || args.ContainsMetaFileByName("tmdb3.json") ||
args.Path.IndexOf("[tmdbid", StringComparison.OrdinalIgnoreCase) != -1;
var isKnownMovie = args.ContainsMetaFileByName("movie.xml");
if (args.Path.IndexOf("[trailers]", StringComparison.OrdinalIgnoreCase) != -1)
{