added xml support for new music video fields
This commit is contained in:
parent
cc1f30b9ff
commit
24bb7c393f
|
@ -76,6 +76,7 @@
|
|||
<Compile Include="Music\LastfmArtistProvider.cs" />
|
||||
<Compile Include="Music\LastfmBaseProvider.cs" />
|
||||
<Compile Include="Music\LastfmHelper.cs" />
|
||||
<Compile Include="Music\MusicVideoXmlParser.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Savers\AlbumXmlSaver.cs" />
|
||||
<Compile Include="Savers\ArtistXmlSaver.cs" />
|
||||
|
|
|
@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Providers.Music;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -105,7 +106,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
if (musicVideo != null)
|
||||
{
|
||||
new BaseItemXmlParser<MusicVideo>(Logger).Fetch(musicVideo, path, cancellationToken);
|
||||
new MusicVideoXmlParser(Logger).Fetch(musicVideo, path, cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
42
MediaBrowser.Providers/Music/MusicVideoXmlParser.cs
Normal file
42
MediaBrowser.Providers/Music/MusicVideoXmlParser.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.Xml;
|
||||
|
||||
namespace MediaBrowser.Providers.Music
|
||||
{
|
||||
public class MusicVideoXmlParser : BaseItemXmlParser<MusicVideo>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public MusicVideoXmlParser(ILogger logger)
|
||||
: base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the data from XML node.
|
||||
/// </summary>
|
||||
/// <param name="reader">The reader.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
protected override void FetchDataFromXmlNode(XmlReader reader, MusicVideo item)
|
||||
{
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "Artist":
|
||||
item.Artist = reader.ReadElementContentAsString();
|
||||
break;
|
||||
|
||||
case "Album":
|
||||
item.Album = reader.ReadElementContentAsString();
|
||||
break;
|
||||
|
||||
default:
|
||||
base.FetchDataFromXmlNode(reader, item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,6 +79,20 @@ namespace MediaBrowser.Providers.Savers
|
|||
builder.Append("<Description><![CDATA[" + item.Overview + "]]></Description>");
|
||||
}
|
||||
|
||||
var musicVideo = item as MusicVideo;
|
||||
|
||||
if (musicVideo != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(musicVideo.Artist))
|
||||
{
|
||||
builder.Append("<Artist>" + SecurityElement.Escape(musicVideo.Artist) + "</Artist>");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(musicVideo.Album))
|
||||
{
|
||||
builder.Append("<Album>" + SecurityElement.Escape(musicVideo.Album) + "</Album>");
|
||||
}
|
||||
}
|
||||
|
||||
XmlSaverHelpers.AddMediaInfo((Video)item, builder);
|
||||
|
||||
builder.Append("</Title>");
|
||||
|
|
Loading…
Reference in New Issue
Block a user