public static string FindSeries(string name)
        {
            string      url            = string.Format(rootUrl + seriesQuery, HttpUtility.UrlEncode(name));
            XmlDocument doc            = TVUtils.Fetch(url);
            XmlNodeList nodes          = doc.SelectNodes("//Series");
            string      comparableName = GetComparableName(name);

            foreach (XmlNode node in nodes)
            {
                XmlNode n = node.SelectSingleNode("./SeriesName");
                if (GetComparableName(n.InnerText) == comparableName)
                {
                    n = node.SelectSingleNode("./seriesid");
                    if (n != null)
                    {
                        return(n.InnerText);
                    }
                }
            }
            return(null);
        }
        public override void Fetch()
        {
            folderDate = new FileInfo(Item.Path).LastWriteTimeUtc;
            //all we need to do here is fill in season number
            Season season = Item as Season;

            if (season != null)
            {
                if (season.SeasonNumber == null)
                {
                    string seasonNum    = TVUtils.SeasonNumberFromFolderName(Item.Path);
                    int    seasonNumber = Int32.Parse(seasonNum);

                    season.SeasonNumber = seasonNumber.ToString();

                    if (season.SeasonNumber == "0")
                    {
                        season.Name = "Specials";
                    }
                }
            }
        }
Exemple #3
0
        public string FindSeries(string name)
        {
            //if id is specified in the file name return it directly
            string id = Helper.GetAttributeFromPath(Item.Path, "tvdbid");

            if (id != null)
            {
                Logger.ReportInfo("TVDbProvider: TVDb ID specified in file path.  Using: " + id);
                return(id);
            }

            //nope - search for it
            string      url            = string.Format(rootUrl + seriesQuery, HttpUtility.UrlEncode(name));
            XmlDocument doc            = TVUtils.Fetch(url);
            XmlNodeList nodes          = doc.SelectNodes("//Series");
            string      comparableName = GetComparableName(name);

            foreach (XmlNode node in nodes)
            {
                XmlNode n = node.SelectSingleNode("./SeriesName");
                if (GetComparableName(n.InnerText) == comparableName)
                {
                    n = node.SelectSingleNode("./seriesid");
                    if (n != null)
                    {
                        return(n.InnerText);
                    }
                }
                else
                {
                    Logger.ReportInfo("TVDb Provider - " + n.InnerText + " did not match " + comparableName);
                }
            }
            Logger.ReportInfo("TVDb Provider - Could not find " + name + ". Check name on Thetvdb.org.");
            return(null);
        }
Exemple #4
0
        private bool FetchEpisodeData()
        {
            var episode = Item as Episode;

            string name     = Item.Name;
            string location = Item.Path;

            Logger.ReportVerbose("TvDbProvider: Fetching episode data: " + name);
            string epNum = TVUtils.EpisodeNumberFromFile(location);

            if (epNum == null)
            {
                return(false);
            }
            int episodeNumber = Int32.Parse(epNum);

            episode.EpisodeNumber = episodeNumber.ToString();
            bool UsingAbsoluteData = false;

            if (string.IsNullOrEmpty(seriesId))
            {
                return(false);
            }

            string seasonNumber = "";

            if (Item.Parent is Season)
            {
                seasonNumber = (Item.Parent as Season).SeasonNumber;
            }

            if (string.IsNullOrEmpty(seasonNumber))
            {
                seasonNumber = TVUtils.SeasonNumberFromEpisodeFile(location); // try and extract the season number from the file name for S1E1, 1x04 etc.
            }
            if (!string.IsNullOrEmpty(seasonNumber))
            {
                seasonNumber = seasonNumber.TrimStart('0');

                if (string.IsNullOrEmpty(seasonNumber))
                {
                    seasonNumber = "0"; // Specials
                }

                XmlDocument doc = TVUtils.Fetch(string.Format(episodeQuery, TVUtils.TVDBApiKey, seriesId, seasonNumber, episodeNumber, Config.Instance.PreferredMetaDataLanguage));
                //episode does not exist under this season, try absolute numbering.
                //still assuming it's numbered as 1x01
                //this is basicly just for anime.
                if (doc == null && Int32.Parse(seasonNumber) == 1)
                {
                    doc = TVUtils.Fetch(string.Format(absEpisodeQuery, TVUtils.TVDBApiKey, seriesId, seasonNumber, episodeNumber, Config.Instance.PreferredMetaDataLanguage));
                    UsingAbsoluteData = true;
                }
                if (doc != null)
                {
                    var p = doc.SafeGetString("//filename");
                    if (p != null)
                    {
                        if (Kernel.Instance.ConfigData.SaveLocalMeta)
                        {
                            Kernel.IgnoreFileSystemMods = true;
                            if (!Directory.Exists(MetaFolderName))
                            {
                                Directory.CreateDirectory(MetaFolderName);
                            }
                            Item.PrimaryImagePath       = TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + p, Path.Combine(MetaFolderName, Path.GetFileNameWithoutExtension(p)));
                            Kernel.IgnoreFileSystemMods = false;
                        }
                        else
                        {
                            Item.PrimaryImagePath = TVUtils.BannerUrl + p;
                        }
                    }

                    Item.Overview = doc.SafeGetString("//Overview");
                    if (UsingAbsoluteData)
                    {
                        episode.EpisodeNumber = doc.SafeGetString("//absolute_number");
                    }
                    if (episode.EpisodeNumber == null)
                    {
                        episode.EpisodeNumber = doc.SafeGetString("//EpisodeNumber");
                    }

                    episode.Name         = episode.EpisodeNumber + " - " + doc.SafeGetString("//EpisodeName");
                    episode.SeasonNumber = doc.SafeGetString("//SeasonNumber");
                    episode.ImdbRating   = doc.SafeGetSingle("//Rating", (float)-1, 10);
                    episode.FirstAired   = doc.SafeGetString("//FirstAired");
                    DateTime airDate;
                    int      y = DateTime.TryParse(episode.FirstAired, out airDate) ? airDate.Year : -1;
                    if (y > 1850)
                    {
                        episode.ProductionYear = y;
                    }


                    string actors = doc.SafeGetString("//GuestStars");
                    if (actors != null)
                    {
                        episode.Actors = new List <Actor>(actors.Trim('|').Split('|')
                                                          .Select(str => new Actor()
                        {
                            Name = str
                        })
                                                          );
                    }


                    string directors = doc.SafeGetString("//Director");
                    if (directors != null)
                    {
                        episode.Directors = new List <string>(directors.Trim('|').Split('|'));
                    }


                    string writers = doc.SafeGetString("//Writer");
                    if (writers != null)
                    {
                        episode.Writers = new List <string>(writers.Trim('|').Split('|'));
                    }

                    if (Kernel.Instance.ConfigData.SaveLocalMeta)
                    {
                        try
                        {
                            Kernel.IgnoreFileSystemMods = true;
                            if (!Directory.Exists(MetaFolderName))
                            {
                                Directory.CreateDirectory(MetaFolderName);
                            }
                            doc.Save(MetaFileName);
                            Kernel.IgnoreFileSystemMods = false;
                        }
                        catch (Exception e)
                        {
                            Logger.ReportException("Error saving local series meta.", e);
                        }
                    }

                    Logger.ReportVerbose("TvDbProvider: Success");
                    return(true);
                }
            }

            return(false);
        }
Exemple #5
0
        private bool FetchEpisodeData()
        {
            var episode = Item as Episode;

            string name     = Item.Name;
            string location = Item.Path;

            Logger.ReportInfo("TvDbProvider: Fetching episode data: " + name);
            string epNum = TVUtils.EpisodeNumberFromFile(location);

            if (epNum == null)
            {
                return(false);
            }
            int episodeNumber = Int32.Parse(epNum);

            episode.EpisodeNumber = episodeNumber.ToString();
            bool UsingAbsoluteData = false;

            if (string.IsNullOrEmpty(seriesId))
            {
                return(false);
            }

            string seasonNumber = "";

            if (Item.Parent is Season)
            {
                seasonNumber = (Item.Parent as Season).SeasonNumber;
            }

            if (string.IsNullOrEmpty(seasonNumber))
            {
                seasonNumber = TVUtils.SeasonNumberFromEpisodeFile(location); // try and extract the season number from the file name for S1E1, 1x04 etc.
            }
            if (!string.IsNullOrEmpty(seasonNumber))
            {
                seasonNumber = seasonNumber.TrimStart('0');

                XmlDocument doc = TVUtils.Fetch(string.Format(episodeQuery, TVUtils.TVDBApiKey, seriesId, seasonNumber, episodeNumber, Config.Instance.PreferredMetaDataLanguage));
                //episode does not exist under this season, try absolute numbering.
                //still assuming it's numbered as 1x01
                //this is basicly just for anime.
                if (doc == null && Int32.Parse(seasonNumber) == 1)
                {
                    doc = TVUtils.Fetch(string.Format(absEpisodeQuery, TVUtils.TVDBApiKey, seriesId, seasonNumber, episodeNumber, Config.Instance.PreferredMetaDataLanguage));
                    UsingAbsoluteData = true;
                }
                if (doc != null)
                {
                    var p = doc.SafeGetString("//filename");
                    if (p != null)
                    {
                        Item.PrimaryImagePath = TVUtils.BannerUrl + p;
                    }


                    Item.Overview = doc.SafeGetString("//Overview");
                    if (UsingAbsoluteData)
                    {
                        episode.EpisodeNumber = doc.SafeGetString("//absolute_number");
                    }
                    if (episode.EpisodeNumber == null)
                    {
                        episode.EpisodeNumber = doc.SafeGetString("//EpisodeNumber");
                    }

                    episode.Name         = episode.EpisodeNumber + " - " + doc.SafeGetString("//EpisodeName");
                    episode.SeasonNumber = doc.SafeGetString("//SeasonNumber");
                    episode.ImdbRating   = doc.SafeGetSingle("//Rating", (float)-1, 10);


                    string actors = doc.SafeGetString("//GuestStars");
                    if (actors != null)
                    {
                        episode.Actors = new List <Actor>(actors.Trim('|').Split('|')
                                                          .Select(str => new Actor()
                        {
                            Name = str
                        })
                                                          );
                    }


                    string directors = doc.SafeGetString("//Director");
                    if (directors != null)
                    {
                        episode.Directors = new List <string>(directors.Trim('|').Split('|'));
                    }


                    string writers = doc.SafeGetString("//Writer");
                    if (writers != null)
                    {
                        episode.Writers = new List <string>(writers.Trim('|').Split('|'));
                    }

                    Logger.ReportInfo("TvDbProvider: Success");
                    return(true);
                }
            }

            return(false);
        }
        private bool FetchSeriesData()
        {
            bool   success = false;
            Series series  = Item as Series;

            string name = Item.Name;

            Logger.ReportInfo("TvDbProvider: Fetching series data: " + name);

            if (string.IsNullOrEmpty(seriesId))
            {
                seriesId = FindSeries(name);
            }

            if (!string.IsNullOrEmpty(seriesId))
            {
                string      url = string.Format(seriesGet, TVUtils.TVDBApiKey, seriesId, Config.Instance.PreferredMetaDataLanguage);
                XmlDocument doc = TVUtils.Fetch(url);
                if (doc != null)
                {
                    success = true;

                    series.Name       = doc.SafeGetString("//SeriesName");
                    series.Overview   = doc.SafeGetString("//Overview");
                    series.ImdbRating = doc.SafeGetSingle("//Rating", 0, 10);

                    string n = doc.SafeGetString("//banner");
                    if ((n != null) && (n.Length > 0))
                    {
                        series.BannerImagePath = TVUtils.BannerUrl + n;
                    }


                    string actors = doc.SafeGetString("//Actors");
                    if (actors != null)
                    {
                        string[] a = actors.Trim('|').Split('|');
                        if (a.Length > 0)
                        {
                            series.Actors = new List <Actor>();
                            series.Actors.AddRange(
                                a.Select(actor => new Actor {
                                Name = actor
                            }));
                        }
                    }

                    series.MpaaRating = doc.SafeGetString("//ContentRating");

                    string g = doc.SafeGetString("//Genre");

                    if (g != null)
                    {
                        string[] genres = g.Trim('|').Split('|');
                        if (g.Length > 0)
                        {
                            series.Genres = new List <string>();
                            series.Genres.AddRange(genres);
                        }
                    }
                }
            }
            if ((!string.IsNullOrEmpty(seriesId)) && ((series.PrimaryImagePath == null) || (series.BackdropImagePath == null)))
            {
                XmlDocument banners = TVUtils.Fetch(string.Format("http://www.thetvdb.com/api/" + TVUtils.TVDBApiKey + "/series/{0}/banners.xml", seriesId));
                if (banners != null)
                {
                    XmlNode n = banners.SelectSingleNode("//Banner[BannerType='poster']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            series.PrimaryImagePath = TVUtils.BannerUrl + n.InnerText;
                        }
                    }


                    n = banners.SelectSingleNode("//Banner[BannerType='fanart']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            series.BackdropImagePath = TVUtils.BannerUrl + n.InnerText;
                        }
                    }
                }
            }

            return(success);
        }
Exemple #7
0
        private bool FetchSeriesData()
        {
            bool   success = false;
            Series series  = Item as Series;

            string name = Item.Name;

            Logger.ReportVerbose("TvDbProvider: Fetching series data: " + name);

            if (string.IsNullOrEmpty(seriesId))
            {
                seriesId = FindSeries(name);
            }

            if (!string.IsNullOrEmpty(seriesId))
            {
                string      url = string.Format(seriesGet, TVUtils.TVDBApiKey, seriesId, Config.Instance.PreferredMetaDataLanguage);
                XmlDocument doc = TVUtils.Fetch(url);
                if (doc != null)
                {
                    success = true;

                    series.Name       = doc.SafeGetString("//SeriesName");
                    series.Overview   = doc.SafeGetString("//Overview");
                    series.ImdbRating = doc.SafeGetSingle("//Rating", 0, 10);

                    string n = doc.SafeGetString("//banner");
                    if ((n != null) && (n.Length > 0))
                    {
                        series.BannerImagePath = TVUtils.BannerUrl + n;
                    }

                    string s = doc.SafeGetString("//Network");
                    if ((s != null) && (s.Length > 0))
                    {
                        series.Studios = new List <string>(s.Trim().Split('|'));
                    }

                    string      urlActors = string.Format(getActors, TVUtils.TVDBApiKey, seriesId);
                    XmlDocument docActors = TVUtils.Fetch(urlActors);
                    if (docActors != null)
                    {
                        series.Actors = null;
                        XmlNode actorsNode = null;
                        if (Kernel.Instance.ConfigData.SaveLocalMeta)
                        {
                            //add to the main doc for saving
                            var seriesNode = doc.SelectSingleNode("//Series");
                            if (seriesNode != null)
                            {
                                actorsNode = doc.CreateNode(XmlNodeType.Element, "Actors", null);
                                seriesNode.AppendChild(actorsNode);
                            }
                        }
                        foreach (XmlNode p in docActors.SelectNodes("Actors/Actor"))
                        {
                            if (series.Actors == null)
                            {
                                series.Actors = new List <Actor>();
                            }
                            string actorName = p.SafeGetString("Name");
                            string actorRole = p.SafeGetString("Role");
                            if (!string.IsNullOrEmpty(name))
                            {
                                series.Actors.Add(new Actor {
                                    Name = actorName, Role = actorRole
                                });
                            }

                            if (Kernel.Instance.ConfigData.SaveLocalMeta && actorsNode != null)
                            {
                                //add to main doc for saving
                                actorsNode.AppendChild(doc.ImportNode(p, true));
                            }
                        }
                    }

                    //string actors = doc.SafeGetString("//Actors");
                    //if (actors != null) {
                    //    string[] a = actors.Trim('|').Split('|');
                    //    if (a.Length > 0) {
                    //        series.Actors = new List<Actor>();
                    //        series.Actors.AddRange(
                    //            a.Select(actor => new Actor { Name = actor }));
                    //    }
                    //}

                    series.MpaaRating = doc.SafeGetString("//ContentRating");

                    string g = doc.SafeGetString("//Genre");

                    if (g != null)
                    {
                        string[] genres = g.Trim('|').Split('|');
                        if (g.Length > 0)
                        {
                            series.Genres = new List <string>();
                            series.Genres.AddRange(genres);
                        }
                    }
                }

                if (Kernel.Instance.ConfigData.SaveLocalMeta)
                {
                    try
                    {
                        Kernel.IgnoreFileSystemMods = true;
                        doc.Save(System.IO.Path.Combine(Item.Path, LOCAL_META_FILE_NAME));
                        Kernel.IgnoreFileSystemMods = false;
                    }
                    catch (Exception e)
                    {
                        Logger.ReportException("Error saving local series meta.", e);
                    }
                }
            }
            if ((!string.IsNullOrEmpty(seriesId)) && ((series.PrimaryImagePath == null) || (series.BackdropImagePath == null)))
            {
                XmlDocument banners = TVUtils.Fetch(string.Format("http://www.thetvdb.com/api/" + TVUtils.TVDBApiKey + "/series/{0}/banners.xml", seriesId));
                if (banners != null)
                {
                    XmlNode n = banners.SelectSingleNode("//Banner[BannerType='poster']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            if (Kernel.Instance.ConfigData.SaveLocalMeta)
                            {
                                Kernel.IgnoreFileSystemMods = true;
                                series.PrimaryImagePath     = TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + n.InnerText, Path.Combine(Item.Path, "folder"));
                                Kernel.IgnoreFileSystemMods = false;
                            }
                            else
                            {
                                series.PrimaryImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }

                    n = banners.SelectSingleNode("//Banner[BannerType='series']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            if (Kernel.Instance.ConfigData.SaveLocalMeta)
                            {
                                Kernel.IgnoreFileSystemMods = true;
                                series.BannerImagePath      = TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + n.InnerText, Path.Combine(Item.Path, "banner"));
                                Kernel.IgnoreFileSystemMods = false;
                            }
                            else
                            {
                                series.BannerImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }

                    int bdNo = 0;
                    foreach (XmlNode b in banners.SelectNodes("//Banner[BannerType='fanart']"))
                    {
                        series.BackdropImagePaths = new List <string>();
                        var p = b.SelectSingleNode("./BannerPath");
                        if (p != null)
                        {
                            if (Kernel.Instance.ConfigData.SaveLocalMeta)
                            {
                                Kernel.IgnoreFileSystemMods = true;
                                series.BackdropImagePaths.Add(TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + p.InnerText, Path.Combine(Item.Path, "backdrop" + (bdNo > 0 ? bdNo.ToString() : ""))));
                                Kernel.IgnoreFileSystemMods = false;
                                bdNo++;
                                if (bdNo >= Kernel.Instance.ConfigData.MaxBackdrops)
                                {
                                    break;
                                }
                            }
                            else
                            {
                                series.BackdropImagePaths.Add(TVUtils.BannerUrl + p.InnerText);
                            }
                        }
                    }
                }
            }


            return(success);
        }
        private bool FetchSeasonData()
        {
            Season season = Season;
            string name   = Item.Name;

            Logger.ReportVerbose("TvDbProvider: Fetching season data: " + name);
            string seasonNum    = TVUtils.SeasonNumberFromFolderName(Item.Path);
            int    seasonNumber = Int32.Parse(seasonNum);

            season.SeasonNumber = seasonNumber.ToString();

            if (season.SeasonNumber == "0")
            {
                season.Name = "Specials";
            }

            if (!string.IsNullOrEmpty(seriesId))
            {
                if ((Item.PrimaryImagePath == null) || (Item.BannerImagePath == null) || (Item.BackdropImagePath == null))
                {
                    XmlDocument banners = TVUtils.Fetch(string.Format("http://www.thetvdb.com/api/" + TVUtils.TVDBApiKey + "/series/{0}/banners.xml", seriesId));


                    XmlNode n = banners.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber.ToString() + "']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            if (Kernel.Instance.ConfigData.SaveLocalMeta)
                            {
                                season.PrimaryImagePath = TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + n.InnerText, Path.Combine(season.Path, "folder"));
                            }
                            else
                            {
                                season.PrimaryImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }


                    n = banners.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber.ToString() + "']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            if (Kernel.Instance.ConfigData.SaveLocalMeta)
                            {
                                season.BannerImagePath = TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + n.InnerText, Path.Combine(season.Path, "banner"));
                            }
                            else
                            {
                                season.BannerImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }


                    n = banners.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber.ToString() + "']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null && Item.BackdropImagePath == null)
                        {
                            if (Kernel.Instance.ConfigData.SaveLocalMeta && Kernel.Instance.ConfigData.SaveSeasonBackdrops)
                            {
                                season.BackdropImagePath = TVUtils.FetchAndSaveImage(TVUtils.BannerUrl + n.InnerText, Path.Combine(Item.Path, "backdrop"));
                            }
                            else
                            {
                                Item.BackdropImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }
                    else if (!Kernel.Instance.ConfigData.SaveLocalMeta)   //if saving local - season will inherit from series
                    {
                        // not necessarily accurate but will give a different bit of art to each season
                        XmlNodeList lst = banners.SelectNodes("//Banner[BannerType='fanart']");
                        if (lst.Count > 0)
                        {
                            int num = seasonNumber % lst.Count;
                            n = lst[num];
                            n = n.SelectSingleNode("./BannerPath");
                            if (n != null && Item.BackdropImagePath == null)
                            {
                                Item.BackdropImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }
                }
                Logger.ReportVerbose("TvDbProvider: Success");
                return(true);
            }

            return(false);
        }
        private bool FetchSeasonData()
        {
            Season season = Season;

            string name = Item.Name;

            Logger.ReportInfo("TvDbProvider: Fetching season data: " + name);
            string seasonNum    = TVUtils.SeasonNumberFromFolderName(Item.Path);
            int    seasonNumber = Int32.Parse(seasonNum);

            season.SeasonNumber = seasonNumber.ToString();

            if (!string.IsNullOrEmpty(seriesId))
            {
                if ((Item.PrimaryImagePath == null) || (Item.BannerImagePath == null) || (Item.BackdropImagePath == null))
                {
                    XmlDocument banners = TVUtils.Fetch(string.Format("http://www.thetvdb.com/api/" + TVUtils.TVDBApiKey + "/series/{0}/banners.xml", seriesId));


                    XmlNode n = banners.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber.ToString() + "']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            season.PrimaryImagePath = TVUtils.BannerUrl + n.InnerText;
                        }
                    }


                    n = banners.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber.ToString() + "']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            Item.BannerImagePath = TVUtils.BannerUrl + n.InnerText;
                        }
                    }


                    n = banners.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber.ToString() + "']");
                    if (n != null)
                    {
                        n = n.SelectSingleNode("./BannerPath");
                        if (n != null)
                        {
                            Item.BackdropImagePath = TVUtils.BannerUrl + n.InnerText;
                        }
                    }
                    else
                    {
                        // not necessarily accurate but will give a different bit of art to each season
                        XmlNodeList lst = banners.SelectNodes("//Banner[BannerType='fanart']");
                        if (lst.Count > 0)
                        {
                            int num = seasonNumber % lst.Count;
                            n = lst[num];
                            n = n.SelectSingleNode("./BannerPath");
                            if (n != null)
                            {
                                Item.BackdropImagePath = TVUtils.BannerUrl + n.InnerText;
                            }
                        }
                    }
                }
                Logger.ReportInfo("TvDbProvider: Success");
                return(true);
            }

            return(false);
        }