예제 #1
0
        /// <summary>
        /// parse the MB .xml file
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public VideoInfo ParseMB(XmlDocument doc)
        {
            VideoInfo videoInfo = new VideoInfo();

            videoInfo.Initialize();

            videoInfo.videoItem.title = MyXMLDoc.GetSingleNodeString(doc, "/Title/LocalTitle");

            videoInfo.videoItem.plot = MyXMLDoc.GetSingleNodeString(doc, "/Title/Overview");

            videoInfo.videoItem.movieset = "";
            videoInfo.videoItem.tagline  = MyXMLDoc.GetSingleNodeString(doc, "/Title/tagline");

            videoInfo.videoItem.imdbId = MyXMLDoc.GetSingleNodeString(doc, "/Title/IMDB");
            videoInfo.videoItem.tmdbId = MyXMLDoc.GetSingleNodeString(doc, "/Title/TMDbId");
            videoInfo.videoItem.mpaa   = MyXMLDoc.GetSingleNodeString(doc, "/Title/ContentRating");

            videoInfo.videoItem.imdbRating = MyXMLDoc.GetSingleNodeDecimal(doc, "/Title/Rating");

            videoInfo.videoItem.year    = MyXMLDoc.GetSingleNodeInt(doc, "/Title/ProductionYear");
            videoInfo.videoItem.runtime = MyXMLDoc.GetSingleNodeInt(doc, "/Title/RunningTime");


            videoInfo.videoItem.playCount = 0;
            videoInfo.videoItem.watched   = "NO";

            return(videoInfo);
        }
예제 #2
0
        /// <summary>
        /// parse the XBMC .nfo file
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public VideoInfo ParseXBMC(XmlDocument doc)
        {
            VideoInfo videoInfo = new VideoInfo();

            videoInfo.Initialize();

            List <string> innerTexts;

            videoInfo.videoItem.title = MyXMLDoc.GetSingleNodeString(doc, "/movie/title");

            videoInfo.videoItem.plot = MyXMLDoc.GetSingleNodeString(doc, "/movie/plot");

            videoInfo.videoItem.movieset = MyXMLDoc.GetSingleNodeString(doc, "/movie/set");
            videoInfo.videoItem.tagline  = MyXMLDoc.GetSingleNodeString(doc, "/movie/tagline");

            videoInfo.videoItem.imdbId = MyXMLDoc.GetSingleNodeString(doc, "/movie/id");
            videoInfo.videoItem.tmdbId = MyXMLDoc.GetSingleNodeString(doc, "/movie/tmdbId");
            videoInfo.videoItem.mpaa   = MyXMLDoc.GetSingleNodeString(doc, "/movie/mpaa");

            videoInfo.videoItem.imdbRating = MyXMLDoc.GetSingleNodeDecimal(doc, "/movie/rating");

            videoInfo.videoItem.year      = MyXMLDoc.GetSingleNodeInt(doc, "/movie/year");
            videoInfo.videoItem.runtime   = MyXMLDoc.GetSingleNodeInt(doc, "/movie/runtime");
            videoInfo.videoItem.playCount = MyXMLDoc.GetSingleNodeInt(doc, "/movie/playcount");
            int watched = MyXMLDoc.GetSingleNodeInt(doc, "/movie/watched");

            if (watched != 0 && watched != 1)
            {
                watched = 0;
            }
            videoInfo.videoItem.watched = VideoFileEnums.watched.GetKeyByValue(watched);

            videoInfo.videoItem.encoding        = new VideoEncoding();
            videoInfo.videoItem.encoding.codec  = MyXMLDoc.GetSingleNodeString(doc, "/movie/fileinfo/streamdetails/video/codec");
            videoInfo.videoItem.encoding.width  = MyXMLDoc.GetSingleNodeInt(doc, "/movie/fileinfo/streamdetails/video/width");
            videoInfo.videoItem.encoding.height = MyXMLDoc.GetSingleNodeInt(doc, "/movie/fileinfo/streamdetails/video/height");


            innerTexts = MyXMLDoc.GetMultipleNodeString(doc, "/movie/director");
            videoInfo.videoItem.directors = new List <VideoItemDirector <string> > {
            };
            foreach (string innerText in innerTexts)
            {
                videoInfo.videoItem.directors.Add(new VideoItemDirector <string>(innerText));
            }

            innerTexts = MyXMLDoc.GetMultipleNodeString(doc, "/movie/genre");
            videoInfo.videoItem.genres = new List <VideoItemGenre <string> > {
            };
            foreach (string innerText in innerTexts)
            {
                videoInfo.videoItem.genres.Add(new VideoItemGenre <string>(innerText));
            }

            innerTexts = MyXMLDoc.GetMultipleNodeString(doc, "/movie/tag");
            videoInfo.videoItem.tags = new List <VideoItemTag <string> > {
            };
            foreach (string innerText in innerTexts)
            {
                videoInfo.videoItem.tags.Add(new VideoItemTag <string>(innerText));
            }



            videoInfo.videoItem.actors = new List <VideoItemActor <string, string> >();
            List <Dictionary <string, string> > actorInfos = MyXMLDoc.GetMultipleNestedNodeString(doc, "/movie/actor");

            foreach (Dictionary <string, string> actorInfo in actorInfos)
            {
                VideoItemActor <string, string> videoItemActor = new VideoItemActor <string, string>();
                foreach (KeyValuePair <string, string> info in actorInfo)
                {
                    switch (info.Key)
                    {
                    case "name":
                        videoItemActor.name = info.Value;
                        break;

                    case "role":
                        videoItemActor.role = info.Value;
                        break;

                    case "thumb":
                        break;

                    default:
                        break;
                    }
                }
                if (!String.IsNullOrEmpty(videoItemActor.name))
                {
                    videoInfo.videoItem.actors.Add(videoItemActor);
                }
            }

            return(videoInfo);
        }