You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs

60 lines
1.9 KiB

using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using System.Collections.Generic;
using System.IO;
8 years ago
using System.Xml;
using MediaBrowser.Model.IO;
8 years ago
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Xml;
namespace MediaBrowser.LocalMetadata.Savers
{
8 years ago
public class GameSystemXmlSaver : BaseXmlSaver
{
8 years ago
public GameSystemXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
{
}
8 years ago
public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{
if (!item.SupportsLocalMetadata)
{
return false;
}
return item is GameSystem && updateType >= ItemUpdateType.MetadataDownload;
}
8 years ago
protected override List<string> GetTagsUsed()
{
8 years ago
var list = new List<string>
{
"GameSystem"
};
8 years ago
return list;
}
8 years ago
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
{
var gameSystem = (GameSystem)item;
if (!string.IsNullOrEmpty(gameSystem.GameSystemName))
{
8 years ago
writer.WriteElementString("GameSystem", gameSystem.GameSystemName);
}
}
8 years ago
protected override string GetLocalSavePath(IHasMetadata item)
{
return Path.Combine(item.Path, "gamesystem.xml");
}
8 years ago
protected override string GetRootElementName(IHasMetadata item)
{
return "Item";
}
}
}