2014-09-06 04:21:23 +00:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
2014-08-05 23:59:24 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2014-08-03 02:16:37 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2014-08-05 03:41:56 +00:00
|
|
|
|
using MediaBrowser.Controller.Playlists;
|
2014-08-03 02:16:37 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2016-10-30 07:02:23 +00:00
|
|
|
|
using System.Xml;
|
2016-10-25 19:02:04 +00:00
|
|
|
|
using MediaBrowser.Model.IO;
|
2016-10-30 07:02:23 +00:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
using MediaBrowser.Model.Xml;
|
2014-08-03 02:16:37 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.LocalMetadata.Savers
|
|
|
|
|
{
|
2016-10-30 07:02:23 +00:00
|
|
|
|
public class PlaylistXmlSaver : BaseXmlSaver
|
2014-08-03 02:16:37 +00:00
|
|
|
|
{
|
2016-10-30 07:02:23 +00:00
|
|
|
|
public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
2014-08-03 02:16:37 +00:00
|
|
|
|
{
|
|
|
|
|
if (!item.SupportsLocalMetadata)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-05 03:41:56 +00:00
|
|
|
|
return item is Playlist && updateType >= ItemUpdateType.MetadataImport;
|
2014-08-03 02:16:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-30 07:02:23 +00:00
|
|
|
|
protected override List<string> GetTagsUsed()
|
2014-08-03 02:16:37 +00:00
|
|
|
|
{
|
2016-10-30 07:02:23 +00:00
|
|
|
|
var list = new List<string>
|
2014-08-05 23:59:24 +00:00
|
|
|
|
{
|
2016-10-30 07:02:23 +00:00
|
|
|
|
"OwnerUserId",
|
|
|
|
|
"PlaylistMediaType"
|
|
|
|
|
};
|
2014-08-03 02:16:37 +00:00
|
|
|
|
|
2016-10-30 07:02:23 +00:00
|
|
|
|
return list;
|
|
|
|
|
}
|
2014-08-03 02:16:37 +00:00
|
|
|
|
|
2016-10-30 07:02:23 +00:00
|
|
|
|
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
|
|
|
|
|
{
|
|
|
|
|
var game = (Playlist)item;
|
2014-08-03 02:16:37 +00:00
|
|
|
|
|
2016-10-30 07:02:23 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(game.PlaylistMediaType))
|
2014-08-05 23:59:24 +00:00
|
|
|
|
{
|
2016-10-30 07:02:23 +00:00
|
|
|
|
writer.WriteElementString("PlaylistMediaType", game.PlaylistMediaType);
|
|
|
|
|
}
|
2014-08-03 02:16:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-30 07:02:23 +00:00
|
|
|
|
protected override string GetLocalSavePath(IHasMetadata item)
|
2014-08-03 02:16:37 +00:00
|
|
|
|
{
|
|
|
|
|
return Path.Combine(item.Path, "playlist.xml");
|
|
|
|
|
}
|
2016-10-30 07:02:23 +00:00
|
|
|
|
|
|
|
|
|
public PlaylistXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
|
|
|
|
{
|
|
|
|
|
}
|
2014-08-03 02:16:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|