Пример #1
0
 private void actorsBox_OnTextChanged(object sender, EventArgs e)
 {
     List<Actor> tmp = new List<Actor>(SelectedItem.Actors);
     SelectedItem.Actors = new List<Actor>();
     foreach (string s in actorsBox.text.Split(','))
     {
         Actor actor = new Actor();
         Regex r = new Regex(@"^(?<name>[^\(]+)\((?<role>.+)\)$");
         Match m = r.Match(s.Trim());
         if (m.Success)
         {
             actor.Role = m.Groups["role"].Value.Trim();
             actor.Name = m.Groups["name"].Value.Trim();
         }
         else
             actor.Name = s.Trim();
         Actor a = tmp.Find(A => A.Name == actor.Name || A.Role == actor.Role);
         if (a != null && !string.IsNullOrEmpty(a.ImagePath))
             actor.ImagePath = a.ImagePath;
         SelectedItem.Actors.Add(actor);
     }
     UpdateActors();
     HasChanged();
 }
Пример #2
0
        public override Item Fetch(Item item)
        {
            Item movie = new Item();
            movie.ProvidersId = item.ProvidersId;
            DataProviderId dp = movie.ProvidersId.Find(p => p.Name == this.Name);
            if (dp == null) return null;
            movie.ProvidersId = new List<DataProviderId> { dp };
            XmlDocument InfosDoc = Helper.Fetch(string.Format(GetInfo, lang, APIKey, dp.Id));
            if (InfosDoc == null)
                return null;

            //Titre
            movie.Title = InfosDoc.SafeGetString("//name");

            //Url
            dp.Url = InfosDoc.SafeGetString("//url");

            //Année
            string release = InfosDoc.SafeGetString("//released");
            if (release != null && release.Length >= 4)
                movie.Year = Int32.Parse(release.Substring(0, 4));

            //Equipe
            movie.Crew = new List<CrewMember>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//cast/person[@job!='Actor']"))
            {
                movie.Crew.Add(new CrewMember { Name = n.Attributes["name"].InnerText, Activity = n.Attributes["job"].InnerText });
            }

            //Résumé
            movie.Overview = InfosDoc.SafeGetString("//overview");

            //TagLine
            string tagline = InfosDoc.SafeGetString("//tagline");
            if (!string.IsNullOrEmpty(tagline))
                movie.TagLines = new List<string> { tagline };

            //Durée
            try { movie.RunningTime = Int32.Parse(InfosDoc.SafeGetString("//runtime")); }
            catch { }

            //Trailer
            string trailer = InfosDoc.SafeGetString("trailer");
            if (!string.IsNullOrEmpty(trailer))
                movie.TrailerFiles = new List<string> { trailer };

            //Pays
            foreach (XmlNode n in InfosDoc.SelectNodes("//countries/country"))
            {
                if (movie.Countries == null) movie.Countries = new List<string>();
                movie.Countries.Add(n.Attributes["name"].InnerText);
            }

            //Genre
            movie.Genres = new List<string>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//categories/category[@type='genre']"))
            {
                    movie.Genres.Add(n.Attributes["name"].InnerText);
            }

            //Vignettes
            movie.ImagesPaths = new List<Poster>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//images/image[@type='poster']"))
            {
                string id = n.Attributes["id"].InnerText;
                if (!movie.ImagesPaths.Exists(ip => ip.Id == id))
                    movie.ImagesPaths.Add(new Poster { Id = id });
                if (n.Attributes["size"].InnerText == "original")
                {
                    movie.ImagesPaths[movie.ImagesPaths.FindIndex(ip => ip.Id == id)].Image = n.Attributes["url"].InnerText;
                }
                else if (n.Attributes["size"].InnerText == "thumb")
                {
                    movie.ImagesPaths[movie.ImagesPaths.FindIndex(ip => ip.Id == id)].Thumb = n.Attributes["url"].InnerText;
                }
            }

            //Backdrop
            movie.BackdropImagePaths = new List<Poster>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//images/image[@type='backdrop']"))
            {
                string id = n.Attributes["id"].InnerText;
                if (n.Attributes["size"].InnerText == "original")
                {
                    int size = 0;
                    Int32.TryParse(n.Attributes["width"].InnerText, out size);
                    if (size >= Config.Instance.MinBackdropWidth)
                    {
                        Poster poster = new Poster();
                        poster.Id = id;
                        poster.Checked = false;
                        poster.Image = n.Attributes["url"].InnerText;
                        movie.BackdropImagePaths.Add(poster);
                    }
                }
                else if (n.Attributes["size"].InnerText == "thumb" && movie.BackdropImagePaths.Exists(p => p.Id == id))
                {
                    movie.BackdropImagePaths[movie.BackdropImagePaths.FindIndex(ip => ip.Id == id)].Thumb = n.Attributes["url"].InnerText;
                }

            }
            if (movie.BackdropImagePaths.Count > 0)
            {
                for (int i = 0; i < Math.Min(movie.BackdropImagePaths.Count, Config.Instance.MaxBdSaved); i++)
                {
                    movie.BackdropImagePaths[i].Checked = true;
                }
            }

            //Note
            movie.Rating = InfosDoc.SafeGetSingle("//rating", -1, 10);

            //MPAA
            movie.MPAARating = InfosDoc.SafeGetString("//certification");

            // Studios
            movie.Studios = new List<string>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//studios/studio"))
            {
                movie.Studios.Add(n.Attributes["name"].InnerText);
            }

            //Acteurs
            movie.Actors = null;
            foreach (XmlNode n in InfosDoc.SelectNodes("//cast/person[@job='Actor']"))
            {
                if (movie.Actors == null)
                    movie.Actors = new List<Actor>();
                string name = n.Attributes["name"].InnerText;
                string role = n.Attributes["character"].InnerText;
                if (!string.IsNullOrEmpty(name))
                {
                    Actor actor = new Actor();
                    actor.Name = name;
                    actor.Role = role;
                    string ActorImg = n.Attributes["thumb"].InnerText;
                    if (!string.IsNullOrEmpty(ActorImg) && !ActorImg.EndsWith("Actor_Unknow.png"))
                        actor.ImagePath = ActorImg;
                    movie.Actors.Add(actor);
                }
            }

            return movie;
        }
Пример #3
0
        public override Item Fetch(Item item)
        {
            Item movie = new Item();
            movie.ProvidersId = item.ProvidersId;
            DataProviderId dp = movie.ProvidersId.Find(p => p.Name == this.Name);
            if (dp == null) return null;
            movie.ProvidersId = new List<DataProviderId> { dp };
            XmlDocument InfosDoc = Helper.Fetch(string.Format(GetInfo, dp.Id), Encoding.UTF8);
            if (InfosDoc == null)
                return null;
            XmlNode node = InfosDoc.GetNodeByName("movie");
            //Titre
            movie.Title = CleanAllocineTitle(SafeGetString(node, "title"));

            //Titre original
            movie.OriginalTitle = CleanAllocineTitle(SafeGetString(node, "originalTitle"));

            //Année
            string release = SafeGetString(node, "productionYear");
            if (release != null && release.Length == 4)
                movie.Year = Int32.Parse(release);

            //Résumé
            movie.Overview = SafeGetString(node, "synopsis");

            //Durée
            try { movie.RunningTime = (int)(Int32.Parse(SafeGetString(node, "runtime")) / 60); }
            catch { }

            //Media
            XmlNode mediaNode = node.GetNodeByName("mediaList");
            foreach (XmlNode mNode in mediaNode.SelectChildren())
            {
                XmlNode typeNode = mNode.GetNodeByName("type");
                if (typeNode == null) continue;
                string typeCode = typeNode.Attributes["code"].InnerText;
                //Posters
                if (typeCode == "31001")
                {
                    if (movie.ImagesPaths == null) movie.ImagesPaths = new List<Poster>();
                    XmlNode thumbNode = mNode.GetNodeByName("thumbnail");
                    if (thumbNode == null) continue;
                    movie.ImagesPaths.Add(new Poster { Image = thumbNode.Attributes["href"].InnerText });
                }

                //Backdrops
                if (typeCode == "31006")
                {
                    if (movie.BackdropImagePaths == null) movie.BackdropImagePaths = new List<Poster>();
                    XmlNode thumbNode = mNode.GetNodeByName("thumbnail");
                    if (thumbNode == null) continue;
                    movie.BackdropImagePaths.Add(new Poster { Image = thumbNode.Attributes["href"].InnerText });
                }

                //Trailers
                if (PluginOptions.Instance.UseTrailers && (typeCode == "31003" || typeCode == "31016"))
                {
                    if (movie.TrailerFiles == null) movie.TrailerFiles = new List<string>();
                    string cmedia = mNode.Attributes["code"].InnerText;
                    XmlDocument trailerDoc = Helper.Fetch(string.Format(GetTrailers, cmedia), Encoding.UTF8);
                    if (trailerDoc != null)
                    {
                        XmlNode n = trailerDoc.SelectSingleNode("//AcVisionVideo");
                        if (n != null)
                        {
                            string url = n.Attributes["hd_path"].InnerText;
                            if (string.IsNullOrEmpty(url))
                                url = n.Attributes["md_path"].InnerText;
                            if (string.IsNullOrEmpty(url))
                                url = n.Attributes["ld_path"].InnerText;
                            if (!string.IsNullOrEmpty(url))
                            {
                                movie.TrailerFiles.Add(url);
                            }
                        }
                    }
                }
            }

            //Pays
            XmlNode countryNode = node.GetNodeByName("nationalityList");
            foreach (XmlNode n in countryNode.SelectChildren())
            {
                if (movie.Countries == null) movie.Countries = new List<string>();
                if (!string.IsNullOrEmpty(n.InnerText))
                    movie.Countries.Add(n.InnerText);
            }

            //Genre
            XmlNode genreNode = node.GetNodeByName("genreList");
            foreach (XmlNode n in genreNode.SelectChildren())
            {
                if (movie.Genres == null) movie.Genres = new List<string>();
                if (!string.IsNullOrEmpty(n.InnerText))
                    movie.Genres.Add(n.InnerText);
            }

            //Note
            XmlNode statNode = node.GetNodeByName("statistics");
            if (statNode != null)
            {
                XmlNode ratingNode = statNode.GetNodeByName("ratingStats");
                float? rating = null;
                double vote = 0; double note = 0;
                foreach (XmlNode n in ratingNode.SelectChildren())
                {
                        double V; double N;
                        try
                        {
                            V = Int32.Parse(n.InnerText);
                            N = double.Parse(n.Attributes["note"].InnerText, CultureInfo.InvariantCulture) * 2;
                        }
                        catch { continue; }
                        vote = vote + V;
                        note = note + (N * V);
                }
                    if (vote > 0)
                        rating = (float)Math.Round((double)(note / vote), 1);

                movie.Rating = rating;
            }

            //Acteurs - Equipe
            XmlNode castingNode = node.GetNodeByName("casting");
            foreach (XmlNode n in castingNode.SelectChildren())
            {
                string activity = SafeGetString(n, "activity");
                if (activity == "Acteur" || activity == "Actrice")
                {
                    if (movie.Actors == null) movie.Actors = new List<Actor>();
                    Actor actor = new Actor();
                    actor.Name = SafeGetString(n, "person");
                    actor.Role = SafeGetString(n, "role");
                    actor.ImagePath = SafeGetString(n, "picture");
                    movie.Actors.Add(actor);
                }
                else
                {
                    if (movie.Crew == null) movie.Crew = new List<CrewMember>();
                    CrewMember cm = new CrewMember();
                    cm.Name = SafeGetString(n, "person");
                    cm.Activity = activity;
                    movie.Crew.Add(cm);
                }
            }

            return movie;
        }
Пример #4
0
        public override Item Fetch(Item item)
        {
            Item movie = new Item();
            movie.ProvidersId = item.ProvidersId;
            DataProviderId dp = movie.ProvidersId.Find(p => p.Name == this.Name || p.Name == "AlloCine");
            if (dp == null) return null;
            movie.ProvidersId = new List<DataProviderId>{dp};
            XmlDocument InfosDoc = Helper.Fetch(string.Format(GetInfo, UsernameEnc(), PasswordEnc(), PluginOptions.Instance.Language, XbmcKey, dp.Id));
            if (InfosDoc == null)
                return null;

            //Id
            string allocine = InfosDoc.SafeGetString("//id_allocine");
            if (!string.IsNullOrEmpty(allocine)) movie.ProvidersId.Add(new DataProviderId
            {
                Name = "AlloCine",
                Id = allocine,
                Url = "http://www.allocine.fr/film/fichefilm_gen_cfilm=" + allocine + ".html"
            });
            string imdb = InfosDoc.SafeGetString("//id_imdb");
            if (!string.IsNullOrEmpty(imdb)) movie.ProvidersId.Add(new DataProviderId
            {
                Name = "Imdb",
                Id = "tt0" + imdb,
                Url = "http://www.imdb.com/title/tt0" + imdb
            });

            //Titre
            movie.Title = CleanAllocineTitle(InfosDoc.SafeGetString("//title"));

            //Titre original
            movie.OriginalTitle = CleanAllocineTitle(InfosDoc.SafeGetString("//originaltitle"));

            //Url
            dp.Url = InfosDoc.SafeGetString("//url");

            //Année
            string release = InfosDoc.SafeGetString("//year");
            if (release != null && release.Length == 4)
                movie.Year = Int32.Parse(release);

            //Producteur
            movie.Crew = new List<CrewMember>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//directors/director"))
            {
                movie.Crew.Add(new CrewMember { Name = n.InnerText, Activity = "Producteur" });
            }

            //Résumé
            movie.Overview = InfosDoc.SafeGetString("//plot");

            //TagLine
            movie.TagLines = new List<string>{ InfosDoc.SafeGetString("//tagline")};

            //Durée
            try { movie.RunningTime = Int32.Parse(InfosDoc.SafeGetString("//runtime")); }
            catch { }

            //Trailer
            foreach (XmlNode n in InfosDoc.SelectNodes("//trailers/trailer"))
            {
                if (movie.TrailerFiles == null) movie.TrailerFiles = new List<string>();
                if (!string.IsNullOrEmpty(n.InnerText))
                    movie.TrailerFiles.Add(n.InnerText);
            }

            //Pays
            foreach (XmlNode n in InfosDoc.SelectNodes("//countries/country"))
            {
                if (movie.Countries == null) movie.Countries = new List<string>();
                if (!string.IsNullOrEmpty(n.InnerText))
                    movie.Countries.Add(n.InnerText);
            }

            //Genre
            movie.Genres = new List<string>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//genres/genre"))
            {
                if (!string.IsNullOrEmpty(n.InnerText))
                    movie.Genres.Add(n.InnerText);
            }

            //Vignettes
            movie.ImagesPaths = new List<Poster>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//images/image[@type='Poster']"))
            {
                string id = n.Attributes["id"].InnerText;
                if (!movie.ImagesPaths.Exists(ip => ip.Id == id))
                    movie.ImagesPaths.Add(new Poster { Id = id });
                if (n.Attributes["size"].InnerText == "original")
                {
                    movie.ImagesPaths[movie.ImagesPaths.FindIndex(ip => ip.Id == id)].Image = n.Attributes["url"].InnerText;
                    movie.ImagesPaths[movie.ImagesPaths.FindIndex(ip => ip.Id == id)].width = n.Attributes["width"].InnerText;
                    movie.ImagesPaths[movie.ImagesPaths.FindIndex(ip => ip.Id == id)].height = n.Attributes["height"].InnerText;
                }
                else if (n.Attributes["size"].InnerText == "preview")
                {
                    movie.ImagesPaths[movie.ImagesPaths.FindIndex(ip => ip.Id == id)].Thumb = n.Attributes["url"].InnerText;
                }
            }

            //Backdrop
            movie.BackdropImagePaths = new List<Poster>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//images/image[@type='Fanart']"))
            {
                string id = n.Attributes["id"].InnerText;
                if (n.Attributes["size"].InnerText == "original")
                {
                    int size = 0;
                    Int32.TryParse(n.Attributes["width"].InnerText, out size);
                    if (size >= Config.Instance.MinBackdropWidth)
                    {
                        Poster poster = new Poster();
                        poster.Id = id;
                        poster.Checked = false;
                        poster.Image = n.Attributes["url"].InnerText;
                        poster.width = n.Attributes["width"].InnerText;
                        poster.height = n.Attributes["height"].InnerText;
                        movie.BackdropImagePaths.Add(poster);
                    }
                }
                else if (n.Attributes["size"].InnerText == "thumb" && movie.BackdropImagePaths.Exists(p => p.Id == id))
                {
                    movie.BackdropImagePaths[movie.BackdropImagePaths.FindIndex(ip => ip.Id == id)].Thumb = n.Attributes["url"].InnerText;
                }

            }
            if (movie.BackdropImagePaths.Count > 0)
            {
                for (int i = 0; i < Math.Min(movie.BackdropImagePaths.Count, Config.Instance.MaxBdSaved); i++)
                {
                    movie.BackdropImagePaths[i].Checked = true;
                }
            }

            //Note
            float? rating = null;
            if (PluginOptions.Instance.Rating != "moyenne des trois")
            {
                try
                {
                    rating = (float)double.Parse(InfosDoc.SelectSingleNode("//ratings/rating[@type='" + PluginOptions.Instance.Rating + "']").InnerText);
                }
                catch { }
            }
            else
            {
                double vote = 0; double note = 0;
                foreach (XmlNode n in InfosDoc.SelectNodes("//ratings/rating"))
                {
                    double V; double N;
                    try
                    {
                        N = double.Parse(n.InnerText, new CultureInfo("fr-FR"));
                        V = Int32.Parse(n.Attributes["votes"].InnerText);
                    }
                    catch { continue; }
                    vote = vote + V;
                    note = note + (N * V);
                }
                if (vote > 0)
                    rating = (float)Math.Round((double)(note / vote), 1);
            }
            movie.Rating = rating;

            // Studios
            movie.Studios = new List<string>();
            foreach (XmlNode n in InfosDoc.SelectNodes("//studios/studio"))
            {
                if (!string.IsNullOrEmpty(n.InnerText))
                    movie.Studios.Add(n.InnerText);
            }

            //Acteurs
            movie.Actors = null;
            foreach (XmlNode n in InfosDoc.SelectNodes("//casting/person"))
            {
                if (movie.Actors == null)
                    movie.Actors = new List<Actor>();
                string name = n.Attributes["name"].InnerText;
                string role = n.Attributes["character"].InnerText;
                if (!string.IsNullOrEmpty(name))
                {
                    Actor actor = new Actor();
                    actor.Name = name;
                    actor.Role = role;
                    string ActorImg = n.Attributes["thumb"].InnerText;
                    if (!string.IsNullOrEmpty(ActorImg) && !ActorImg.EndsWith("Actor_Unknow.png"))
                        actor.ImagePath = ActorImg;
                    movie.Actors.Add(actor);
                }
            }

            return movie;
        }
Пример #5
0
        private static void FetchXmlMovie(Item movie)
        {
            string mfile = Path.Combine(location, videofilename + ".nfo");

            if (File.Exists(mfile))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(mfile);

                movie.Title = doc.SafeGetString("movie/title");
                movie.OriginalTitle = doc.SafeGetString("movie/originaltitle");
                movie.SortTitle = doc.SafeGetString("movie/sorttitle");
                DateTime added;
                DateTime.TryParse(doc.SafeGetString("movie/added"), out added);
                if (added != null) movie.DateAdded = added;

                int? y = doc.SafeGetInt32("movie/year", 0);
                if (y.IsValidYear()) movie.Year = y;

                int? rt = doc.SafeGetInt32("movie/runtime", 0);
                if (rt.IsValidRunningTime())  movie.RunningTime = rt;

                movie.Rating = doc.SafeGetSingle("movie/rating", (float)-1, (float)10);
                movie.MPAARating = doc.SafeGetString("movie/mpaa");
                movie.Overview = doc.SafeGetString("movie/plot");
                movie.Mediatype = doc.SafeGetString("movie/type");
                movie.AspectRatio = doc.SafeGetString("movie/aspectratio");

                foreach (XmlNode node in doc.SelectNodes("movie/actor"))
                {
                    if (movie.Actors == null)
                        movie.Actors = new List<Actor>();
                    Actor actor = new Actor();
                    actor.Name = node.SafeGetString("name");
                    actor.Role = node.SafeGetString("role");
                    actor.ImagePath = node.SafeGetString("thumb");
                    if (string.IsNullOrEmpty(actor.ImagePath) && Directory.Exists(PluginOptions.Instance.ActorsThumbPath))
                    {
                        string actorImage = Path.Combine(PluginOptions.Instance.ActorsThumbPath, actor.Name + ".tbn");
                        if (File.Exists(actorImage))
                            actor.ImagePath = actorImage;
                    }
                    movie.Actors.Add(actor);
                }

                foreach (XmlNode node in doc.SelectNodes("movie/director"))
                {
                    if (movie.Crew == null) movie.Crew = new List<CrewMember>();
                    movie.Crew.Add(new CrewMember { Name = node.InnerText, Activity = "Director" });
                }

                foreach (XmlNode node in doc.SelectNodes("movie/genre"))
                {
                    if (movie.Genres == null) movie.Genres = new List<string>();
                    movie.Genres.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("movie/studio"))
                {
                    if (movie.Studios == null) movie.Studios = new List<string>();
                    movie.Studios.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("movie/country"))
                {
                    if (movie.Countries == null) movie.Countries = new List<string>();
                    movie.Countries.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("movie/tagline"))
                {
                    if (movie.TagLines == null) movie.TagLines = new List<string>();
                    movie.TagLines.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("movie/trailer"))
                {
                    if (movie.TrailerFiles == null) movie.TrailerFiles = new List<string>();
                    movie.TrailerFiles.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("movie/thumb"))
                {
                    if (movie.ImagesPaths == null) movie.ImagesPaths = new List<Poster>();
                    movie.ImagesPaths.AddDistinctPoster(new Poster { Image = node.InnerText });
                }

                foreach (XmlNode node in doc.SelectNodes("movie/fanart/thumb"))
                {
                    if (movie.BackdropImagePaths == null) movie.BackdropImagePaths = new List<Poster>();
                    movie.BackdropImagePaths.AddDistinctPoster(new Poster { Image = node.InnerText });
                }

            }
        }
Пример #6
0
        private static void FetchSeries(Item series)
        {
            string mfile = Path.Combine(location, "tvshow.nfo");

            if (File.Exists(mfile))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(mfile);

                series.SeriesName = series.Title = doc.SafeGetString("tvshow/title");
                series.Rating = doc.SafeGetSingle("tvshow/rating", (float)-1, (float)10);

                string id = doc.SafeGetString("tvshow/id");
                if (!string.IsNullOrEmpty(id))
                {
                    series.ProvidersId = new List<DataProviderId>();
                    series.ProvidersId.Add(new DataProviderId { Id = id, Name = "TheTVDB", Url = "http://thetvdb.com/?tab=series&id=" + id });
                }

                series.Overview = doc.SafeGetString("tvshow/overview");

                foreach (XmlNode node in doc.SelectNodes("tvshow/actor"))
                {
                    if (series.Actors == null)
                        series.Actors = new List<Actor>();
                    Actor actor = new Actor();
                    actor.Name = node.SafeGetString("name");
                    actor.Role = node.SafeGetString("role");
                    actor.ImagePath = node.SafeGetString("thumb");
                    if (string.IsNullOrEmpty(actor.ImagePath) && Directory.Exists(PluginOptions.Instance.ActorsThumbPath))
                    {
                        string actorImage = Path.Combine(PluginOptions.Instance.ActorsThumbPath, actor.Name + ".tbn");
                        if (File.Exists(actorImage))
                            actor.ImagePath = actorImage;
                    }
                    series.Actors.Add(actor);
                }

                foreach (XmlNode node in doc.SelectNodes("tvshow/genre"))
                {
                    if (series.Genres == null) series.Genres = new List<string>();
                    series.Genres.Add(node.InnerText);
                }

                series.MPAARating = doc.SafeGetString("mpaa");

                int? rt = doc.SafeGetInt32("tvshow/runtime", 0);
                if (rt.IsValidRunningTime()) series.RunningTime = rt;

                series.Rating = doc.SafeGetSingle("tvshow/rating", (float)-1, (float)10);

                foreach (XmlNode node in doc.SelectNodes("tvshow/studio"))
                {
                    if (series.Studios == null) series.Studios = new List<string>();
                    series.Studios.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("tvshow/tagline"))
                {
                    if (series.TagLines == null) series.TagLines = new List<string>();
                    series.TagLines.Add(node.InnerText);
                }

                foreach (XmlNode node in doc.SelectNodes("tvshow/thumb"))
                {
                    if (series.BannersPaths == null) series.BannersPaths = new List<Poster>();
                    series.BannersPaths.AddDistinctPoster(new Poster { Image = node.InnerText });
                }
            }
        }
Пример #7
0
        private static void FetchEpisode(Item episode)
        {
            var mfile = Path.Combine(location, videofilename + ".nfo");
            if (File.Exists(mfile))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(mfile);

                episode.Overview = doc.SafeGetString("episodedetails/plot");
                episode.EpisodeNumber = doc.SafeGetString("episodedetails/episode");
                episode.Title = doc.SafeGetString("episodedetails/title");
                episode.SeasonNumber = doc.SafeGetString("episodedetails/season");
                episode.Rating = doc.SafeGetSingle("episodedetails/rating", (float)-1, 10);

                foreach (XmlNode node in doc.SelectNodes("episodedetails/actor"))
                {
                    if (episode.Actors == null)
                        episode.Actors = new List<Actor>();
                    Actor actor = new Actor();
                    actor.Name = node.SafeGetString("name");
                    actor.Role = node.SafeGetString("role");
                    actor.ImagePath = node.SafeGetString("thumb");
                    if (string.IsNullOrEmpty(actor.ImagePath) && Directory.Exists(PluginOptions.Instance.ActorsThumbPath))
                    {
                        string actorImage = Path.Combine(PluginOptions.Instance.ActorsThumbPath, actor.Name + ".tbn");
                        if (File.Exists(actorImage))
                            actor.ImagePath = actorImage;
                    }
                    episode.Actors.Add(actor);
                }

                foreach (XmlNode node in doc.SelectNodes("episodedetails/director"))
                {
                    if (episode.Crew == null) episode.Crew = new List<CrewMember>();
                    episode.Crew.Add(new CrewMember { Name = node.InnerText, Activity = "Director" });
                }

                foreach (XmlNode node in doc.SelectNodes("episodedetails/credit"))
                {
                    if (episode.Crew == null) episode.Crew = new List<CrewMember>();
                    episode.Crew.Add(new CrewMember { Name = node.InnerText, Activity = "Writer" });
                }
            }
        }