Ejemplo n.º 1
0
        /// <inheritdoc/>
        public override Media Clone()
        {
            Episode episodeClone = new Episode(this.Configuration);
            episodeClone.Title = this.Title;
            episodeClone.TitleSort = this.TitleSort;
            episodeClone.TitleOriginal = this.TitleOriginal;
            episodeClone.MediaGroup = this.MediaGroup;
            episodeClone.Rating = this.Rating;
            episodeClone.PublishingYear = this.PublishingYear;
            episodeClone.PublishingDate = this.PublishingDate;
            episodeClone.Content = this.Content;
            episodeClone.RunTime = this.RunTime;
            episodeClone.Images = this.Images; // if required, still to be cloned
            episodeClone.MPAA = this.MPAA;
            episodeClone.PlayCount = this.PlayCount;
            episodeClone.PlayDate = this.PlayDate;
            episodeClone.IMDbId = this.IMDbId;
            episodeClone.Country = this.Country;
            episodeClone.Genres = this.Genres;
            episodeClone.Studios = this.Studios;
            episodeClone.Directors = this.Directors;
            episodeClone.Writers = this.Writers;
            episodeClone.Actors = this.Actors;

            foreach (VideoFile mediaFile in this.MediaFiles)
            {
                episodeClone.MediaFiles.Add((VideoFile)mediaFile.Clone());
            }

            episodeClone.Filename = this.Filename;
            episodeClone.Server = this.Server;
            episodeClone.VideoCodec = this.VideoCodec;
            episodeClone.VideoDefinition = this.VideoDefinition;
            episodeClone.VideoAspectRatio = this.VideoAspectRatio;
            episodeClone.AudioStreams = this.AudioStreams;
            episodeClone.SubTitles = this.SubTitles;
            episodeClone.MediaLanguages = this.MediaLanguages;

            episodeClone.actualSeason = this.actualSeason;
            episodeClone.actualEpisode = this.actualEpisode;
            episodeClone.DisplaySeason = this.DisplaySeason;
            episodeClone.DisplayEpisode = this.DisplayEpisode;
            episodeClone.IsSpecial = this.IsSpecial;
            episodeClone.Series = this.Series;

            return (Episode)episodeClone;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the following attributes for a single episode according to different episode<br />
        /// This is used to extract meta data from the Disc-object in MovieCollector.
        /// <br />
        /// MPAA-rating<br />
        /// Video-Definition<br />
        /// Video-Aspect-Ration<br />
        /// Rating<br />
        /// IsSpecial<br />
        /// Season<br />
        /// DisplaySeason<br />
        /// MediaLanguages<br />
        /// </summary>
        /// <param name="episode">Episode that contains the attributes to be cloned</param>
        public void ExtractSeriesData(Episode episode)
        {
            // clone only relevant Attributes
            this.MPAA = episode.MPAA;
            this.VideoCodec = episode.VideoCodec;
            this.VideoDefinition = episode.VideoDefinition;
            this.VideoAspectRatio = episode.VideoAspectRatio;
            this.Rating = episode.Rating;

            this.IsSpecial = episode.IsSpecial;
            this.actualSeason = episode.ActualSeason;
            this.DisplaySeason = episode.DisplaySeason;
            this.MediaLanguages = episode.MediaLanguages;
        }
        /// <summary>
        /// reads the MovieCollectoz XML export into MediaCollection
        /// </summary>
        /// <remarks>
        ///     requires user defined field:<br/>
        ///     "XBMC Movie" - true if entry is to be interpreted as a movie<br/>
        ///     "XBMC Series" - true if entry is to be interpreted as a series<br/>
        /// </remarks>
        /// <param name="eingabeXML">File that was used while export from MovieCollector - complete local path</param>
        public void ReadXML(string eingabeXML)
        {
            bool xMLMovieIsMovie = false;
            bool xMLMovieIsSeries = false;
            Video media = null;
            foreach (XmlNode xMLMovie in BaseClassExtention.XMLReadFile(eingabeXML, "movieinfo").XMLReadSubnode("movielist").XMLReadSubnodes("movie"))
            {
                #region evaluate Type and create media-object
                foreach (XmlNode xMLUserDefinedValue in xMLMovie.XMLReadSubnode("userdefinedvalues").XMLReadSubnodes("userdefinedvalue"))
                {
                    if (xMLUserDefinedValue.XMLReadSubnode("userdefinedfield").XMLReadSubnode("label").XMLReadInnerText(string.Empty) == "XBMC Movie")
                    {
                        xMLMovieIsMovie = xMLUserDefinedValue.XMLReadSubnode("value").XMLReadInnerText(string.Empty) == "Yes" || xMLUserDefinedValue.XMLReadSubnode("value").XMLReadInnerText(string.Empty) == "Ja";
                    }

                    if (xMLUserDefinedValue.XMLReadSubnode("userdefinedfield").XMLReadSubnode("label").XMLReadInnerText(string.Empty) == "XBMC Serie")
                    {
                        xMLMovieIsSeries = xMLUserDefinedValue.XMLReadSubnode("value").XMLReadInnerText(string.Empty) == "Yes" || xMLUserDefinedValue.XMLReadSubnode("value").XMLReadInnerText(string.Empty) == "Ja";
                    }
                }

                if (xMLMovieIsMovie)
                {
                    if (!this.Configuration.KodiExportMovieAsSeries)
                    {
                        media = new Movie(this.Configuration);
                    }
                    else
                    {
                        xMLMovieIsMovie = false;
                        xMLMovieIsSeries = true;
                    }
                }

                if (xMLMovieIsSeries)
                {
                    media = new Series(this.Configuration);
                }

                if (media == null)
                {
                    continue; // TODO: ### write error log
                }

                #endregion
                #region Media (Movie & Series)

                media.Title = xMLMovie.XMLReadSubnode("title").XMLReadInnerText(string.Empty);
                media.Title = media.OverrideVideoStreamData(media.Title);
                media.PublishingYear = xMLMovie.XMLReadSubnode("releasedate").XMLReadSubnode("year").XMLReadSubnode("displayname").XMLReadInnerText(string.Empty);
                media.TitleSort = xMLMovie.XMLReadSubnode("titlesort").XMLReadInnerText(string.Empty);
                media.TitleOriginal = xMLMovie.XMLReadSubnode("originaltitle").XMLReadInnerText(string.Empty);
                media.MediaGroup = xMLMovie.XMLReadSubnode("series").XMLReadSubnode("displayname").XMLReadInnerText(media.Title);
                media.Rating = xMLMovie.XMLReadSubnode("imdbrating").XMLReadInnerText(string.Empty);
                media.Content = xMLMovie.XMLReadSubnode("plot").XMLReadInnerText(string.Empty);
                media.RunTime = xMLMovie.XMLReadSubnode("runtime").XMLReadInnerText(string.Empty);
                media.MPAA = xMLMovie.XMLReadSubnode("mpaarating").XMLReadSubnode("displayname").XMLReadInnerText(string.Empty);
                media.IMDbId = "tt" + xMLMovie.XMLReadSubnode("imdbnum").XMLReadInnerText(string.Empty);
                media.Country = xMLMovie.XMLReadSubnode("country").XMLReadSubnode("displayname").XMLReadInnerText(string.Empty);
                media.ReadImages(xMLMovie);
                media.ReadGenre(xMLMovie);
                media.ReadStudio(xMLMovie);
                media.ReadCrew(xMLMovie);
                media.ReadCast(xMLMovie);
                media.ReadStreamData(xMLMovie);

                #endregion
                #region Movie

                if (xMLMovieIsMovie)
                {
                    ((Movie)media).VideoIndex = 1;
                    ((Movie)media).ReadMediaFiles(xMLMovie);
                    media.PublishingDate = xMLMovie.XMLReadSubnode("releasedate").XMLReadSubnode("date").XMLReadInnerText(media.PublishingYear);
                    media.PlayCount = (xMLMovie.XMLReadSubnode("seenit").XMLReadInnerText(string.Empty) == "Yes" || xMLMovie.XMLReadSubnode("seenit").XMLReadInnerText(string.Empty) == "Ja") ? "1" : "0";
                    media.PlayDate = xMLMovie.XMLReadSubnode("viewingdate").XMLReadSubnode("date").XMLReadInnerText(string.Empty);

                    if (media.HasSpecials() && media.MediaGroup == string.Empty)
                    {
                        media.MediaGroup = media.Title;
                    }

                    this.MovieCollection.Add((Movie)media);
                }

                #endregion
                #region Series

                if (xMLMovieIsSeries)
                {
                    // releasedate and number episodes in series
                    media.PublishingDate = xMLMovie.XMLReadSubnode("releasedate").XMLReadSubnode("date").XMLReadInnerText(media.PublishingYear);
                    ((Series)media).NumberOfTotalEpisodes = (int)int.Parse(xMLMovie.XMLReadSubnode("chapters").XMLReadInnerText(string.Empty));

                    int videoIndex = 0;

                    // episodes
                    foreach (XmlNode xMLSeriesDisc in xMLMovie.XMLReadSubnode("discs").XMLReadSubnodes("disc"))
                    {
                        Episode seriesDiscEpisode = new Episode(this.Configuration);
                        seriesDiscEpisode.Series = (Series)media;
                        seriesDiscEpisode.ExtractSeriesData((Series)media);
                        seriesDiscEpisode.OverrideSeason(seriesDiscEpisode.OverrideVideoStreamData(xMLSeriesDisc.XMLReadSubnode("title").XMLReadInnerText(string.Empty)), false);

                        foreach (XmlNode xMLEpisode in xMLSeriesDisc.XMLReadSubnode("episodes").XMLReadSubnodes("episode"))
                        {
                            Episode episode = new Episode(this.Configuration);
                            videoIndex++;
                            episode.VideoIndex = videoIndex;

                            // reset Episode-Attributes to Disc-Attributes
                            episode.ExtractSeriesData(seriesDiscEpisode);

                            // read Episode-Details
                            episode.Series = (Series)media;
                            episode.Title = episode.OverrideSeason(episode.OverrideVideoStreamData(xMLEpisode.XMLReadSubnode("title").XMLReadInnerText(string.Empty)), true);
                            episode.TitleSort = episode.Title;
                            episode.TitleOriginal = episode.Title;
                            episode.MediaGroup = episode.Series.MediaGroup;
                            episode.Content = xMLEpisode.XMLReadSubnode("plot").XMLReadInnerText(string.Empty);

                            if (!episode.IsSpecial && episode.Content == string.Empty)
                            {
                                episode.Content = episode.Series.Content;
                            }

                            episode.RunTime = xMLEpisode.XMLReadSubnode("runtimeminutes").XMLReadInnerText(string.Empty);
                            episode.PublishingDate = xMLEpisode.XMLReadSubnode("firstairdate").XMLReadSubnode("date").XMLReadInnerText(episode.Series.PublishingDate);
                            episode.PlayCount = xMLEpisode.XMLReadSubnode("seenit").XMLReadInnerText(string.Empty) == "Yes" || xMLEpisode.XMLReadSubnode("seenit").XMLReadInnerText(string.Empty) == "Ja" ? "1" : "0";
                            episode.PlayDate = xMLEpisode.XMLReadSubnode("viewingdate").XMLReadSubnode("date").XMLReadInnerText(string.Empty);
                            episode.Genres = episode.Series.Genres;
                            episode.Studios = episode.Series.Studios;
                            episode.AudioStreams = episode.Series.AudioStreams;
                            episode.SubTitles = episode.Series.SubTitles;
                            episode.ReadCrew(xMLEpisode);
                            episode.ReadCast(xMLEpisode);
                            episode.ReadMediaFiles(xMLEpisode);
                            episode.ReadImages(xMLEpisode);

                            ((Series)media).Episodes.Add(episode);
                        }
                    }

                    // add SubTitles on series-level
                    ((Series)media).ReadMediaFiles(xMLMovie);

                    this.SeriesCollection.Add((Series)media);
                }

                #endregion
                #region Media (Movie & Series)

                media.SetFilename();

                #endregion
            }

            this.GroupByMediaGroup();
        }