From 95f471e8c3ab466488cc4c2fba1b15e14e00ee3c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 17 Jun 2013 14:48:18 -0400 Subject: [PATCH] fixes #354 - BaseItemXmlParser not handling MusicVideos --- .../Movies/MovieProviderFromXml.cs | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs b/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs index b7d3e6e57..a427f1bac 100644 --- a/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs +++ b/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs @@ -1,12 +1,12 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Logging; using System; using System.IO; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Logging; namespace MediaBrowser.Providers.Movies { @@ -15,7 +15,8 @@ namespace MediaBrowser.Providers.Movies /// public class MovieProviderFromXml : BaseMetadataProvider { - public MovieProviderFromXml(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) + public MovieProviderFromXml(ILogManager logManager, IServerConfigurationManager configurationManager) + : base(logManager, configurationManager) { } @@ -78,25 +79,49 @@ namespace MediaBrowser.Providers.Movies private async Task Fetch(BaseItem item, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); - + var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, "movie.xml")); if (metadataFile != null) { var path = metadataFile.FullName; - var boxset = item as BoxSet; await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false); try { - if (boxset != null) + var movie = item as Movie; + + if (movie != null) { - new BaseItemXmlParser(Logger).Fetch(boxset, path, cancellationToken); + new BaseItemXmlParser(Logger).Fetch(movie, path, cancellationToken); } else { - new BaseItemXmlParser(Logger).Fetch((Movie)item, path, cancellationToken); + var boxset = item as BoxSet; + + if (boxset != null) + { + new BaseItemXmlParser(Logger).Fetch(boxset, path, cancellationToken); + } + else + { + var musicVideo = item as MusicVideo; + + if (musicVideo != null) + { + new BaseItemXmlParser(Logger).Fetch(musicVideo, path, cancellationToken); + } + else + { + var trailer = item as Trailer; + + if (trailer != null) + { + new BaseItemXmlParser(Logger).Fetch(trailer, path, cancellationToken); + } + } + } } } finally