|
|
|
@ -15,16 +15,30 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
{
|
|
|
|
|
public class AlbumNfoSaver : BaseNfoSaver
|
|
|
|
|
{
|
|
|
|
|
public AlbumNfoSaver(
|
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
|
IServerConfigurationManager configurationManager,
|
|
|
|
|
ILibraryManager libraryManager,
|
|
|
|
|
IUserManager userManager,
|
|
|
|
|
IUserDataManager userDataManager,
|
|
|
|
|
ILogger logger)
|
|
|
|
|
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override string GetLocalSavePath(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
return Path.Combine(item.Path, "album.nfo");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override string GetRootElementName(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
return "album";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
|
|
|
|
{
|
|
|
|
|
if (!item.SupportsLocalMetadata)
|
|
|
|
@ -35,6 +49,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
return item is MusicAlbum && updateType >= MinimumUpdateType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
|
|
|
|
|
{
|
|
|
|
|
var album = (MusicAlbum)item;
|
|
|
|
@ -52,8 +67,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
AddTracks(album.Tracks, writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
|
|
|
|
|
|
|
|
|
private void AddTracks(IEnumerable<BaseItem> tracks, XmlWriter writer)
|
|
|
|
|
{
|
|
|
|
|
foreach (var track in tracks.OrderBy(i => i.ParentIndexNumber ?? 0).ThenBy(i => i.IndexNumber ?? 0))
|
|
|
|
@ -62,7 +75,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
|
|
|
|
|
if (track.IndexNumber.HasValue)
|
|
|
|
|
{
|
|
|
|
|
writer.WriteElementString("position", track.IndexNumber.Value.ToString(UsCulture));
|
|
|
|
|
writer.WriteElementString("position", track.IndexNumber.Value.ToString(CultureInfo.InvariantCulture));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(track.Name))
|
|
|
|
@ -81,21 +94,19 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override List<string> GetTagsUsed(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
var list = base.GetTagsUsed(item);
|
|
|
|
|
list.AddRange(new string[]
|
|
|
|
|
{
|
|
|
|
|
"track",
|
|
|
|
|
"artist",
|
|
|
|
|
"albumartist"
|
|
|
|
|
});
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
list.AddRange(
|
|
|
|
|
new string[]
|
|
|
|
|
{
|
|
|
|
|
"track",
|
|
|
|
|
"artist",
|
|
|
|
|
"albumartist"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
public AlbumNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger)
|
|
|
|
|
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
|
|
|
{
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|