added IMetadataSaver

pull/702/head
Luke Pulverenti 12 years ago
parent 4b0f055a16
commit 4954681594

@ -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);
}
}

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

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

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

@ -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(() => { });
}
}
}
Loading…
Cancel
Save