fixes #2559 - URL only movie.nfo does not seem to work at all

This commit is contained in:
Luke Pulverenti 2017-05-10 14:02:08 -04:00
parent f49d20033d
commit e9ea1d4ce2
2 changed files with 37 additions and 1 deletions

View File

@ -15,6 +15,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Xml;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Xml;
@ -227,6 +228,11 @@ namespace MediaBrowser.XbmcMetadata.Parsers
}
}
protected virtual string MovieDbParserSearchString
{
get { return "themoviedb.org/movie/"; }
}
private void ParseProviderLinks(T item, string xml)
{
//Look for a match for the Regex pattern "tt" followed by 7 digits
@ -238,7 +244,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
// Support Tmdb
// http://www.themoviedb.org/movie/36557
var srch = "themoviedb.org/movie/";
var srch = MovieDbParserSearchString;
var index = xml.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
if (index != -1)
@ -250,6 +256,23 @@ namespace MediaBrowser.XbmcMetadata.Parsers
item.SetProviderId(MetadataProviders.Tmdb, tmdbId);
}
}
if (item is Series)
{
srch = "thetvdb.com/?tab=series&id=";
index = xml.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
if (index != -1)
{
var tvdbId = xml.Substring(index + srch.Length).TrimEnd('/');
int value;
if (!string.IsNullOrWhiteSpace(tvdbId) && int.TryParse(tvdbId, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
{
item.SetProviderId(MetadataProviders.Tvdb, tvdbId);
}
}
}
}
protected virtual void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> itemResult)

View File

@ -13,6 +13,19 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{
public class SeriesNfoParser : BaseNfoParser<Series>
{
protected override bool SupportsUrlAfterClosingXmlTag
{
get
{
return true;
}
}
protected override string MovieDbParserSearchString
{
get { return "themoviedb.org/tv/"; }
}
/// <summary>
/// Fetches the data from XML node.
/// </summary>