added IMetadataSaver

This commit is contained in:
Luke Pulverenti 2013-06-09 12:23:06 -04:00
parent 4b0f055a16
commit 4954681594
5 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,27 @@
using MediaBrowser.Controller.Entities;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Library
{
/// <summary>
/// Interface IMetadataSaver
/// </summary>
public interface IMetadataSaver
{
/// <summary>
/// Supportses the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
bool Supports(BaseItem item);
/// <summary>
/// Saves the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task Save(BaseItem item, CancellationToken cancellationToken);
}
}

View File

@ -76,6 +76,7 @@
<Compile Include="Entities\MusicVideo.cs" /> <Compile Include="Entities\MusicVideo.cs" />
<Compile Include="Library\ILibraryPostScanTask.cs" /> <Compile Include="Library\ILibraryPostScanTask.cs" />
<Compile Include="Library\ILibraryPrescanTask.cs" /> <Compile Include="Library\ILibraryPrescanTask.cs" />
<Compile Include="Library\IMetadataSaver.cs" />
<Compile Include="Localization\ILocalizationManager.cs" /> <Compile Include="Localization\ILocalizationManager.cs" />
<Compile Include="Providers\Movies\FanArtMovieUpdatesPrescanTask.cs" /> <Compile Include="Providers\Movies\FanArtMovieUpdatesPrescanTask.cs" />
<Compile Include="Providers\Movies\MovieDbImagesProvider.cs" /> <Compile Include="Providers\Movies\MovieDbImagesProvider.cs" />

View File

@ -67,6 +67,6 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets a value indicating whether [enable image enhancers]. /// Gets or sets a value indicating whether [enable image enhancers].
/// </summary> /// </summary>
/// <value><c>true</c> if [enable image enhancers]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [enable image enhancers]; otherwise, <c>false</c>.</value>
public bool? EnableImageEnhancers { get; set; } public bool EnableImageEnhancers { get; set; }
} }
} }

View File

@ -143,6 +143,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Providers\ProviderManager.cs" /> <Compile Include="Providers\ProviderManager.cs" />
<Compile Include="Reflection\TypeMapper.cs" /> <Compile Include="Reflection\TypeMapper.cs" />
<Compile Include="Savers\MovieXmlSaver.cs" />
<Compile Include="ScheduledTasks\ArtistValidationTask.cs" /> <Compile Include="ScheduledTasks\ArtistValidationTask.cs" />
<Compile Include="ScheduledTasks\PeopleValidationTask.cs" /> <Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
<Compile Include="ScheduledTasks\ChapterImagesTask.cs" /> <Compile Include="ScheduledTasks\ChapterImagesTask.cs" />

View File

@ -0,0 +1,49 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Savers
{
/// <summary>
/// Saves movie.xml for movies, trailers and music videos
/// </summary>
public class MovieXmlSaver : IMetadataSaver
{
/// <summary>
/// Supportses the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public bool Supports(BaseItem item)
{
if (item.LocationType != LocationType.FileSystem)
{
return false;
}
var trailer = item as Trailer;
if (trailer != null)
{
return !trailer.IsLocalTrailer;
}
// Don't support local trailers
return item is Movie || item is MusicVideo;
}
/// <summary>
/// Saves the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public Task Save(BaseItem item, CancellationToken cancellationToken)
{
return Task.Run(() => { });
}
}
}