Additional fixes for multiple movies per folder. Added a provider shell

This commit is contained in:
Luke Pulverenti 2013-08-15 12:21:32 -04:00
parent e934783b95
commit 34bf41721a
5 changed files with 115 additions and 6 deletions

View File

@ -22,6 +22,15 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
[IgnoreDataMember]
protected override bool UseParentPathToCreateResolveArgs
{
get
{
return true;
}
}
/// <summary>
/// We want to group into series not show individually in an index
/// </summary>

View File

@ -45,7 +45,8 @@ namespace MediaBrowser.Controller.Resolvers
return new TVideoType
{
VideoType = type,
Path = args.Path
Path = args.Path,
IsInMixedFolder = true
};
}
}

View File

@ -0,0 +1,95 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers
{
class ImageFromMixedMediaLocationProvider : BaseMetadataProvider
{
public ImageFromMixedMediaLocationProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
: base(logManager, configurationManager)
{
}
public override ItemUpdateType ItemUpdateType
{
get
{
return ItemUpdateType.ImageUpdate;
}
}
/// <summary>
/// Supportses the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public override bool Supports(BaseItem item)
{
if (item.LocationType != LocationType.FileSystem || item.ResolveArgs.IsDirectory)
{
return false;
}
var video = item as Video;
if (video != null && !(item is Episode))
{
return video.IsInMixedFolder;
}
var game = item as Game;
if (game != null)
{
return game.IsInMixedFolder;
}
return false;
}
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.First; }
}
/// <summary>
/// Returns true or false indicating if the provider should refresh when the contents of it's directory changes
/// </summary>
/// <value><c>true</c> if [refresh on file system stamp change]; otherwise, <c>false</c>.</value>
protected override bool RefreshOnFileSystemStampChange
{
get
{
return true;
}
}
/// <summary>
/// Gets the filestamp extensions.
/// </summary>
/// <value>The filestamp extensions.</value>
protected override string[] FilestampExtensions
{
get
{
return BaseItem.SupportedImageExtensions;
}
}
public override Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
{
return TrueTaskResult;
}
}
}

View File

@ -52,6 +52,7 @@
<Compile Include="FolderProviderFromXml.cs" />
<Compile Include="Games\GameProviderFromXml.cs" />
<Compile Include="ImageFromMediaLocationProvider.cs" />
<Compile Include="ImageFromMixedMediaLocationProvider.cs" />
<Compile Include="ImagesByNameProvider.cs" />
<Compile Include="MediaInfo\AudioImageProvider.cs" />
<Compile Include="MediaInfo\BaseFFProbeProvider.cs" />

View File

@ -242,13 +242,16 @@ namespace MediaBrowser.Server.Implementations.Providers
if (saveLocally)
{
var video = item as Video;
if (video != null && video.IsInMixedFolder)
if (!(item is Episode))
{
var folder = Path.GetDirectoryName(video.Path);
var video = item as Video;
path = Path.Combine(folder, Path.GetFileNameWithoutExtension(video.Path) + "-" + filename);
if (video != null && video.IsInMixedFolder)
{
var folder = Path.GetDirectoryName(video.Path);
path = Path.Combine(folder, Path.GetFileNameWithoutExtension(video.Path) + "-" + filename);
}
}
if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(item.MetaLocation))