mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-19 11:44:47 -04:00
Add ReadNormalizedString to XmlReaderExtensions
This commit is contained in:
parent
99832642ce
commit
8a7a1cc723
8 changed files with 112 additions and 372 deletions
|
@ -14,6 +14,18 @@ namespace MediaBrowser.Controller.Extensions;
|
|||
/// </summary>
|
||||
public static class XmlReaderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads a trimmed string from the current node.
|
||||
/// </summary>
|
||||
/// <param name="reader">The <see cref="XmlReader"/>.</param>
|
||||
/// <returns>The trimmed content.</returns>
|
||||
public static string ReadNormalizedString(this XmlReader reader)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(reader);
|
||||
|
||||
return reader.ReadElementContentAsString().Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses a <see cref="DateTime"/> from the current node.
|
||||
/// </summary>
|
||||
|
|
|
@ -137,21 +137,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
|
||||
break;
|
||||
case "OriginalTitle":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrEmpty(val))
|
||||
{
|
||||
item.OriginalTitle = val;
|
||||
}
|
||||
|
||||
item.OriginalTitle = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "LocalTitle":
|
||||
item.Name = reader.ReadElementContentAsString();
|
||||
item.Name = reader.ReadNormalizedString();
|
||||
break;
|
||||
|
||||
case "CriticRating":
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
|
@ -165,63 +155,26 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
}
|
||||
|
||||
case "SortTitle":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.ForcedSortName = val;
|
||||
}
|
||||
|
||||
item.ForcedSortName = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "Overview":
|
||||
case "Description":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.Overview = val;
|
||||
}
|
||||
|
||||
item.Overview = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "Language":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
item.PreferredMetadataLanguage = val;
|
||||
|
||||
item.PreferredMetadataLanguage = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "CountryCode":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
item.PreferredMetadataCountryCode = val;
|
||||
|
||||
item.PreferredMetadataCountryCode = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "PlaceOfBirth":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
var placeOfBirth = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(placeOfBirth) && item is Person person)
|
||||
{
|
||||
if (item is Person person)
|
||||
{
|
||||
person.ProductionLocations = new[] { val };
|
||||
}
|
||||
person.ProductionLocations = new[] { placeOfBirth };
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "LockedFields":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
@ -263,10 +216,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
{
|
||||
if (!reader.IsEmptyElement)
|
||||
{
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
FetchFromCountriesNode(subtree);
|
||||
}
|
||||
reader.Skip();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -278,29 +228,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
|
||||
case "ContentRating":
|
||||
case "MPAARating":
|
||||
{
|
||||
var rating = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(rating))
|
||||
{
|
||||
item.OfficialRating = rating;
|
||||
}
|
||||
|
||||
item.OfficialRating = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "CustomRating":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.CustomRating = val;
|
||||
}
|
||||
|
||||
item.CustomRating = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "RunningTime":
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
|
@ -317,16 +249,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
}
|
||||
|
||||
case "AspectRatio":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val) && item is IHasAspectRatio hasAspectRatio)
|
||||
var aspectRatio = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(aspectRatio) && item is IHasAspectRatio hasAspectRatio)
|
||||
{
|
||||
hasAspectRatio.AspectRatio = val;
|
||||
hasAspectRatio.AspectRatio = aspectRatio;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "LockData":
|
||||
{
|
||||
|
@ -376,32 +305,21 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
|
||||
break;
|
||||
case "Trailer":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
var trailer = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(trailer))
|
||||
{
|
||||
item.AddTrailerUrl(val);
|
||||
item.AddTrailerUrl(trailer);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "DisplayOrder":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (item is IHasDisplayOrder hasDisplayOrder)
|
||||
var displayOrder = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(displayOrder) && item is IHasDisplayOrder hasDisplayOrder)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
hasDisplayOrder.DisplayOrder = val;
|
||||
}
|
||||
hasDisplayOrder.DisplayOrder = displayOrder;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "Trailers":
|
||||
{
|
||||
if (!reader.IsEmptyElement)
|
||||
|
@ -468,8 +386,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
|
||||
break;
|
||||
case "CollectionNumber":
|
||||
var tmdbCollection = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(tmdbCollection))
|
||||
var tmdbCollection = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(tmdbCollection))
|
||||
{
|
||||
item.SetProviderId(MetadataProvider.TmdbCollection, tmdbCollection);
|
||||
}
|
||||
|
@ -672,41 +590,6 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
item.Shares = list.ToArray();
|
||||
}
|
||||
|
||||
private void FetchFromCountriesNode(XmlReader reader)
|
||||
{
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
||||
// Loop through each element
|
||||
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "Country":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches from taglines node.
|
||||
/// </summary>
|
||||
|
@ -725,17 +608,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "Tagline":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.Tagline = val;
|
||||
}
|
||||
|
||||
item.Tagline = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
|
@ -766,17 +640,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "Genre":
|
||||
{
|
||||
var genre = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(genre))
|
||||
var genre = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(genre))
|
||||
{
|
||||
item.AddGenre(genre);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
|
@ -804,17 +674,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "Tag":
|
||||
{
|
||||
var tag = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(tag))
|
||||
var tag = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(tag))
|
||||
{
|
||||
tags.Add(tag);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
|
@ -880,17 +746,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "Trailer":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
var trailer = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(trailer))
|
||||
{
|
||||
item.AddTrailerUrl(val);
|
||||
item.AddTrailerUrl(trailer);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
|
@ -921,17 +783,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "Studio":
|
||||
{
|
||||
var studio = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(studio))
|
||||
var studio = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(studio))
|
||||
{
|
||||
item.AddStudio(studio);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
|
@ -964,17 +822,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "Path":
|
||||
{
|
||||
linkedItem.Path = reader.ReadElementContentAsString();
|
||||
linkedItem.Path = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "ItemId":
|
||||
{
|
||||
linkedItem.LibraryItemId = reader.ReadElementContentAsString();
|
||||
linkedItem.LibraryItemId = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
|
@ -1015,11 +867,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "UserId":
|
||||
{
|
||||
item.UserId = reader.ReadElementContentAsString();
|
||||
item.UserId = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "CanEdit":
|
||||
{
|
||||
item.CanEdit = string.Equals(reader.ReadElementContentAsString(), "true", StringComparison.OrdinalIgnoreCase);
|
||||
|
@ -1027,10 +876,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
}
|
||||
|
||||
default:
|
||||
{
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -30,12 +31,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
switch (reader.Name)
|
||||
{
|
||||
case "PlaylistMediaType":
|
||||
{
|
||||
item.PlaylistMediaType = reader.ReadElementContentAsString();
|
||||
|
||||
item.PlaylistMediaType = reader.ReadNormalizedString();
|
||||
break;
|
||||
}
|
||||
|
||||
case "PlaylistItems":
|
||||
|
||||
if (!reader.IsEmptyElement)
|
||||
|
@ -94,10 +91,8 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
}
|
||||
|
||||
default:
|
||||
{
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -276,27 +276,16 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
|
||||
break;
|
||||
case "originaltitle":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrEmpty(val))
|
||||
{
|
||||
item.OriginalTitle = val;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.OriginalTitle = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "name":
|
||||
case "title":
|
||||
case "localtitle":
|
||||
item.Name = reader.ReadElementContentAsString();
|
||||
item.Name = reader.ReadNormalizedString();
|
||||
break;
|
||||
|
||||
case "sortname":
|
||||
item.SortName = reader.ReadElementContentAsString();
|
||||
item.SortName = reader.ReadNormalizedString();
|
||||
break;
|
||||
|
||||
case "criticrating":
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
|
@ -310,40 +299,16 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "sorttitle":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.ForcedSortName = val;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.ForcedSortName = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "biography":
|
||||
case "plot":
|
||||
case "review":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.Overview = val;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.Overview = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "language":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
item.PreferredMetadataLanguage = val;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.PreferredMetadataLanguage = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "watched":
|
||||
{
|
||||
var val = reader.ReadElementContentAsBoolean();
|
||||
|
@ -386,14 +351,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
|
||||
break;
|
||||
case "countrycode":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
item.PreferredMetadataCountryCode = val;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.PreferredMetadataCountryCode = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "lockedfields":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
@ -415,9 +374,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "tagline":
|
||||
item.Tagline = reader.ReadElementContentAsString();
|
||||
item.Tagline = reader.ReadNormalizedString();
|
||||
break;
|
||||
|
||||
case "country":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
@ -434,29 +392,11 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "mpaa":
|
||||
{
|
||||
var rating = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(rating))
|
||||
{
|
||||
item.OfficialRating = rating;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.OfficialRating = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "customrating":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.CustomRating = val;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.CustomRating = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "runtime":
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
|
@ -470,18 +410,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "aspectratio":
|
||||
var aspectRatio = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(aspectRatio) && item is IHasAspectRatio hasAspectRatio)
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val)
|
||||
&& item is IHasAspectRatio hasAspectRatio)
|
||||
{
|
||||
hasAspectRatio.AspectRatio = val;
|
||||
}
|
||||
|
||||
break;
|
||||
hasAspectRatio.AspectRatio = aspectRatio;
|
||||
}
|
||||
|
||||
break;
|
||||
case "lockdata":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
@ -495,17 +430,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "studio":
|
||||
var studio = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(studio))
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.AddStudio(val);
|
||||
}
|
||||
|
||||
break;
|
||||
item.AddStudio(studio);
|
||||
}
|
||||
|
||||
break;
|
||||
case "director":
|
||||
foreach (var director in reader.GetPersonArray(PersonKind.Director))
|
||||
{
|
||||
|
@ -552,31 +483,24 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
|
||||
break;
|
||||
case "trailer":
|
||||
var trailer = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(trailer))
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
val = val.Replace("plugin://plugin.video.youtube/?action=play_video&videoid=", BaseNfoSaver.YouTubeWatchUrl, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
item.AddTrailerUrl(val);
|
||||
}
|
||||
|
||||
break;
|
||||
item.AddTrailerUrl(trailer.Replace(
|
||||
"plugin://plugin.video.youtube/?action=play_video&videoid=",
|
||||
BaseNfoSaver.YouTubeWatchUrl,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
break;
|
||||
case "displayorder":
|
||||
var displayOrder = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(displayOrder) && item is IHasDisplayOrder hasDisplayOrder)
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (item is IHasDisplayOrder hasDisplayOrder && !string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
hasDisplayOrder.DisplayOrder = val;
|
||||
}
|
||||
|
||||
break;
|
||||
hasDisplayOrder.DisplayOrder = displayOrder;
|
||||
}
|
||||
|
||||
break;
|
||||
case "year":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
@ -656,16 +580,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
|
||||
case "style":
|
||||
case "tag":
|
||||
var tag = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(tag))
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.AddTag(val);
|
||||
}
|
||||
|
||||
break;
|
||||
item.AddTag(tag);
|
||||
}
|
||||
|
||||
break;
|
||||
case "fileinfo":
|
||||
{
|
||||
if (!reader.IsEmptyElement)
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Threading;
|
|||
using System.Xml;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -237,17 +238,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "showtitle":
|
||||
{
|
||||
var showtitle = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(showtitle))
|
||||
{
|
||||
item.SeriesName = showtitle;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.SeriesName = reader.ReadNormalizedString();
|
||||
break;
|
||||
default:
|
||||
base.FetchDataFromXmlNode(reader, itemResult);
|
||||
break;
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Xml;
|
|||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
@ -113,31 +114,23 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "artist":
|
||||
var artist = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(artist) && item is MusicVideo artistVideo)
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val) && item is MusicVideo movie)
|
||||
{
|
||||
var list = movie.Artists.ToList();
|
||||
list.Add(val);
|
||||
movie.Artists = list.ToArray();
|
||||
}
|
||||
|
||||
break;
|
||||
var list = artistVideo.Artists.ToList();
|
||||
list.Add(artist);
|
||||
artistVideo.Artists = list.ToArray();
|
||||
}
|
||||
|
||||
break;
|
||||
case "album":
|
||||
var album = reader.ReadNormalizedString();
|
||||
if (!string.IsNullOrEmpty(album) && item is MusicVideo albumVideo)
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val) && item is MusicVideo movie)
|
||||
{
|
||||
movie.Album = val;
|
||||
}
|
||||
|
||||
break;
|
||||
albumVideo.Album = album;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
base.FetchDataFromXmlNode(reader, itemResult);
|
||||
break;
|
||||
|
|
|
@ -2,6 +2,7 @@ using System.Globalization;
|
|||
using System.Xml;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -56,17 +57,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "seasonname":
|
||||
{
|
||||
var name = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
item.Name = name;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.Name = reader.ReadNormalizedString();
|
||||
break;
|
||||
default:
|
||||
base.FetchDataFromXmlNode(reader, itemResult);
|
||||
break;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Xml;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
@ -76,23 +76,11 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
}
|
||||
|
||||
case "airs_dayofweek":
|
||||
{
|
||||
item.AirDays = TVUtils.GetAirDays(reader.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
|
||||
item.AirDays = TVUtils.GetAirDays(reader.ReadElementContentAsString());
|
||||
break;
|
||||
case "airs_time":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
item.AirTime = val;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
item.AirTime = reader.ReadNormalizedString();
|
||||
break;
|
||||
case "status":
|
||||
{
|
||||
var status = reader.ReadElementContentAsString();
|
||||
|
|
Loading…
Add table
Reference in a new issue