Ejemplo n.º 1
0
 private void LoadFromNfo()
 {
     NfoLoader.Load <MovieMeta>(this, this.NfoFile);
     this.Runtime *= 60; // convert minutes to seconds
     if (Settings.AttemptTrailerDownloadMissingTrailers)
     {
         if (this.Trailer.StartsWith("http"))
         {
             string filenameNoExtension = this.Filename.Substring(0, this.Filename.LastIndexOf("."));
             // only support youtube downloading ATM
             FileInfo trailerFile = new FileInfo(filenameNoExtension + "-trailer.mp4");
             if (Youtube.GetMovie(trailerFile.FullName, this.Trailer))
             {
                 this.Trailer = trailerFile.Name; // want relative path
                 CreateNfoFile();
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void LoadFromNfo()
        {
            string rawXml = System.IO.File.ReadAllText(this.NfoFile);
            List <TvEpisodeMeta> episodes = new List <TvEpisodeMeta>();

            foreach (Match match in Regex.Matches(rawXml, "<episodedetails>(.*?)</episodedetails>", RegexOptions.Singleline))
            {
                XDocument     doc     = XDocument.Parse(match.Value);
                TvEpisodeMeta episode = new TvEpisodeMeta(this.Filename);
                NfoLoader.Load <TvEpisodeMeta>(episode, doc.Element("episodedetails"));
                episodes.Add(episode);
            }
            this.Episodes       = episodes.ToArray();
            this.EpisodeNumbers = (from e in episodes select e.Episode).ToArray();
            if (this.Episodes.Length > 0)
            {
                this.Season = this.Episodes[0].Season;
            }
        }
Ejemplo n.º 3
0
 public static VideoFileMeta Load(XElement Element)
 {
     try
     {
         VideoFileMeta meta = new VideoFileMeta();
         // load video track
         if (Element.Element("streamdetails").Element("video") != null)
         {
             VideoTrack video = new VideoTrack();
             if (NfoLoader.Load <VideoTrack>(video, Element.Element("streamdetails").Element("video")))
             {
                 meta.Video = video;
             }
         }
         // load audio tracks
         foreach (XElement eleAudio in Element.Element("streamdetails").Elements("audio"))
         {
             AudioTrack audio = new AudioTrack();
             if (NfoLoader.Load <AudioTrack>(audio, eleAudio))
             {
                 meta.Audio = meta.Audio.Union(new AudioTrack[] { audio }).ToArray();
             }
         }
         // load subtitle tracks
         foreach (XElement eleSubtitle in Element.Element("streamdetails").Elements("subtitle"))
         {
             SubtitleTrack subtitle = new SubtitleTrack();
             if (NfoLoader.Load <SubtitleTrack>(subtitle, eleSubtitle))
             {
                 meta.Subtitles = meta.Subtitles.Union(new SubtitleTrack[] { subtitle }).ToArray();
             }
         }
         return(meta);
     }
     catch (Exception) { return(null); }
 }