jellyfin/MediaBrowser.LocalMetadata/Savers/FolderXmlSaver.cs

63 lines
2.1 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
2013-06-23 18:55:30 +00:00
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
2016-10-28 18:45:56 +00:00
using System.Xml;
2016-10-25 19:02:04 +00:00
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
2016-10-28 18:45:56 +00:00
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Savers
{
2016-10-28 18:45:56 +00:00
public class FolderXmlSaver : BaseXmlSaver
{
2016-10-28 18:45:56 +00:00
protected override string GetLocalSavePath(IHasMetadata item)
2014-02-02 13:36:31 +00:00
{
2016-10-28 18:45:56 +00:00
return Path.Combine(item.Path, "folder.xml");
2014-02-02 13:36:31 +00:00
}
2016-10-28 18:45:56 +00:00
protected override string GetRootElementName(IHasMetadata item)
{
2016-10-28 18:45:56 +00:00
return "Item";
}
2016-10-28 18:45:56 +00:00
public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{
2014-02-10 20:11:46 +00:00
if (!item.SupportsLocalMetadata)
2014-02-08 20:02:35 +00:00
{
return false;
}
2014-02-11 21:41:01 +00:00
if (item is Folder)
2013-06-25 18:10:39 +00:00
{
if (!(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum) &&
2014-02-02 13:36:31 +00:00
!(item is Season) &&
!(item is GameSystem) &&
!(item is Playlist))
{
2014-12-28 06:21:39 +00:00
return updateType >= ItemUpdateType.MetadataEdit;
}
2013-06-25 18:10:39 +00:00
}
return false;
}
2016-10-28 18:45:56 +00:00
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
}
2016-10-28 18:45:56 +00:00
public FolderXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
{
}
}
}