Exemplo n.º 1
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            if (!aspectData.ContainsKey(PersonAspect.ASPECT_ID))
            {
                return(false);
            }

            GetMetadataChanged(aspectData);

            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_PERSON_NAME, out Name);
            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_ORIGIN, out Orign);
            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_OCCUPATION, out Occupation);

            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_DATEOFBIRTH, out DateOfBirth);
            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_DATEOFDEATH, out DateOfDeath);
            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_GROUP, out IsGroup);

            string tempString;

            MediaItemAspect.TryGetAttribute(aspectData, PersonAspect.ATTR_BIOGRAPHY, out tempString);
            Biography = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));

            string id;

            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_PERSON, out id))
            {
                MovieDbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_PERSON, out id))
            {
                TvdbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_AUDIODB, ExternalIdentifierAspect.TYPE_PERSON, out id))
            {
                AudioDbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_PERSON, out id))
            {
                TvMazeId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_PERSON, out id))
            {
                TvRageId = Convert.ToInt32(id);
            }
            MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_PERSON, out ImdbId);
            MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_MUSICBRAINZ, ExternalIdentifierAspect.TYPE_PERSON, out MusicBrainzId);
            MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_PERSON, out NameId);

            byte[] data;
            if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
            {
                HasThumbnail = true;
            }

            return(true);
        }
Exemplo n.º 2
0
        public override bool FromString(string name)
        {
            Match match = _fromName.Match(name);

            if (match.Success)
            {
                SeriesName   = match.Groups["series"].Value;
                SeasonNumber = Convert.ToInt32(match.Groups["season"].Value);
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
 public override bool FromString(string name)
 {
     if (name.Contains("("))
     {
         Match match = _fromName.Match(name);
         if (match.Success)
         {
             MovieName = match.Groups["movie"].Value;
             int year = Convert.ToInt32(match.Groups["year"].Value);
             if (year > 0)
             {
                 ReleaseDate = new DateTime(year, 1, 1);
             }
             return(true);
         }
         return(false);
     }
     MovieName = name;
     return(true);
 }
Exemplo n.º 4
0
 public override bool FromString(string name)
 {
     if (name.Contains("("))
     {
         Match match = _fromName.Match(name);
         if (match.Success)
         {
             SeriesName = match.Groups["series"].Value;
             int year = Convert.ToInt32(match.Groups["year"].Value);
             if (year > 0)
             {
                 FirstAired = new DateTime(year, 1, 1);
             }
             return(true);
         }
         return(false);
     }
     SeriesName = name;
     return(true);
 }
Exemplo n.º 5
0
        public override bool FromString(string name)
        {
            Match match = _fromName.Match(name);

            if (match.Success)
            {
                SeriesName = match.Groups["series"].Value;
                Match seriesMatch = _fromSeriesName.Match(SeriesName.Text);
                if (seriesMatch.Success)
                {
                    //SeriesName = seriesMatch.Groups["series"].Value;
                    SeriesFirstAired = new DateTime(Convert.ToInt32(seriesMatch.Groups["year"].Value), 1, 1);
                }
                SeasonNumber = Convert.ToInt32(match.Groups["season"].Value);
                EpisodeNumbers.Clear();
                EpisodeNumbers.Add(Convert.ToInt32(match.Groups["episode"].Value));
                EpisodeName = match.Groups["title"].Value;
                return(true);
            }
            return(false);
        }
Exemplo n.º 6
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            bool success = false;

            GetMetadataChanged(aspectData);

            if (aspectData.ContainsKey(SeasonAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, SeasonAspect.ATTR_SEASON, out SeasonNumber);
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_RECORDINGTIME, out FirstAired);

                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, SeasonAspect.ATTR_SERIES_NAME, out tempString);
                SeriesName = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));
                MediaItemAspect.TryGetAttribute(aspectData, SeasonAspect.ATTR_DESCRIPTION, out tempString);
                Description = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));

                int?count;
                if (MediaItemAspect.TryGetAttribute(aspectData, SeasonAspect.ATTR_NUM_EPISODES, out count))
                {
                    TotalEpisodes = count.Value;
                }

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                success = true;
            }
            else if (aspectData.ContainsKey(EpisodeAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_SEASON, out SeasonNumber);

                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_SERIES_NAME, out tempString);
                SeriesName = new SimpleTitle(tempString, false);

                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                success = true;
            }

            if (success)
            {
                CustomIds.Clear();
                CustomSeriesIds.Clear();
                IList <MultipleMediaItemAspect> externalIdAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, ExternalIdentifierAspect.Metadata, out externalIdAspects))
                {
                    foreach (MultipleMediaItemAspect externalId in externalIdAspects)
                    {
                        string source = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_SOURCE);
                        string id     = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_ID);
                        string type   = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_TYPE);
                        if (type == ExternalIdentifierAspect.TYPE_SEASON)
                        {
                            if (source == ExternalIdentifierAspect.SOURCE_TVDB)
                            {
                                TvdbId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_TMDB)
                            {
                                MovieDbId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_TVMAZE)
                            {
                                TvMazeId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_TVRAGE)
                            {
                                TvRageId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_IMDB)
                            {
                                ImdbId = id;
                            }
                            else
                            {
                                CustomIds.Add(source, id);
                            }
                        }
                        else if (type == ExternalIdentifierAspect.TYPE_SERIES)
                        {
                            if (source == ExternalIdentifierAspect.SOURCE_TVDB)
                            {
                                SeriesTvdbId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_TMDB)
                            {
                                SeriesMovieDbId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_TVMAZE)
                            {
                                SeriesTvMazeId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_TVRAGE)
                            {
                                SeriesTvRageId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_IMDB)
                            {
                                SeriesImdbId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_NAME)
                            {
                                SeriesNameId = id;
                            }
                            else
                            {
                                CustomSeriesIds.Add(source, id);
                            }
                        }
                    }
                }
            }
            return(success);
        }
Exemplo n.º 7
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            bool success = false;

            GetMetadataChanged(aspectData);

            if (aspectData.ContainsKey(AudioAlbumAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_ALBUM, out Album);
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_SORT_TITLE, out AlbumSort);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_DISCID, out DiscNum);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_NUMDISCS, out TotalDiscs);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_NUMTRACKS, out TotalTracks);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_COMPILATION, out Compilation);
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_RECORDINGTIME, out ReleaseDate);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_SALES, out Sales);

                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_DESCRIPTION, out tempString);
                Description = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));

                double?rating;
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_TOTAL_RATING, out rating);
                int?voteCount;
                MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_RATING_COUNT, out voteCount);
                Rating = new SimpleRating(rating, voteCount);

                //Brownard 17.06.2016
                //The returned type of the collection differs on the server and client.
                //On the server it's an object collection but on the client it's a string collection due to [de]serialization.
                //Use the non generic Ienumerable to allow for both types.
                IEnumerable collection;
                Artists.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_ARTISTS, out collection))
                {
                    Artists.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                        Name = s, Occupation = PersonAspect.OCCUPATION_ARTIST, ParentMediaName = Album
                    }));
                }
                foreach (PersonInfo artist in Artists)
                {
                    artist.AssignNameId();
                }

                Awards.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_AWARDS, out collection))
                {
                    Awards.AddRange(collection.Cast <string>());
                }

                MusicLabels.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, AudioAlbumAspect.ATTR_LABELS, out collection))
                {
                    MusicLabels.AddRange(collection.Cast <string>().Select(s => new CompanyInfo {
                        Name = s, Type = CompanyAspect.COMPANY_MUSIC_LABEL
                    }));
                }
                foreach (CompanyInfo company in MusicLabels)
                {
                    company.AssignNameId();
                }

                Genres.Clear();
                IList <MultipleMediaItemAspect> genreAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, GenreAspect.Metadata, out genreAspects))
                {
                    foreach (MultipleMediaItemAspect genre in genreAspects)
                    {
                        Genres.Add(new GenreInfo
                        {
                            Id   = genre.GetAttributeValue <int?>(GenreAspect.ATTR_ID),
                            Name = genre.GetAttributeValue <string>(GenreAspect.ATTR_GENRE)
                        });
                    }
                }

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                success = true;
            }
            else if (aspectData.ContainsKey(AudioAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, AudioAspect.ATTR_ALBUM, out Album);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAspect.ATTR_DISCID, out DiscNum);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAspect.ATTR_NUMDISCS, out TotalDiscs);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAspect.ATTR_NUMTRACKS, out TotalTracks);
                MediaItemAspect.TryGetAttribute(aspectData, AudioAspect.ATTR_COMPILATION, out Compilation);

                IEnumerable collection;
                Artists.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, AudioAspect.ATTR_ALBUMARTISTS, out collection))
                {
                    Artists.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                        Name = s, Occupation = PersonAspect.OCCUPATION_ARTIST, ParentMediaName = Album
                    }));
                }
                foreach (PersonInfo artist in Artists)
                {
                    artist.AssignNameId();
                }

                success = true;
            }
            else if (aspectData.ContainsKey(MediaAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_TITLE, out Album);

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                success = true;
            }

            if (success)
            {
                CustomIds.Clear();
                IList <MultipleMediaItemAspect> externalIdAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, ExternalIdentifierAspect.Metadata, out externalIdAspects))
                {
                    foreach (MultipleMediaItemAspect externalId in externalIdAspects)
                    {
                        string source = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_SOURCE);
                        string id     = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_ID);
                        string type   = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_TYPE);
                        if (type == ExternalIdentifierAspect.TYPE_ALBUM)
                        {
                            if (source == ExternalIdentifierAspect.SOURCE_AUDIODB)
                            {
                                AudioDbId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_MUSICBRAINZ)
                            {
                                MusicBrainzId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_MUSICBRAINZ_GROUP)
                            {
                                MusicBrainzGroupId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_CDDB)
                            {
                                CdDdId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_UPCEAN)
                            {
                                UpcEanId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_AMAZON)
                            {
                                AmazonId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_ITUNES)
                            {
                                ItunesId = id;
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_NAME)
                            {
                                NameId = id;
                            }
                            else
                            {
                                CustomIds.Add(source, id);
                            }
                        }
                    }
                }
            }
            return(success);
        }
Exemplo n.º 8
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            if (!aspectData.ContainsKey(EpisodeAspect.ASPECT_ID))
            {
                return(false);
            }

            GetMetadataChanged(aspectData);

            MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_SEASON, out SeasonNumber);
            MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_RECORDINGTIME, out FirstAired);

            string tempString;

            MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_SERIES_NAME, out tempString);
            SeriesName = new SimpleTitle(tempString, false);
            MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_EPISODE_NAME, out tempString);
            EpisodeName = new SimpleTitle(tempString, false);
            MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_SORT_TITLE, out tempString);
            EpisodeNameSort = new SimpleTitle(tempString, false);
            MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_STORYPLOT, out tempString);
            Summary = new SimpleTitle(tempString, false);

            double value;

            if (MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_TOTAL_RATING, out value))
            {
                Rating.RatingValue = value;
            }

            int count;

            if (MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_RATING_COUNT, out count))
            {
                Rating.VoteCount = count;
            }

            string id;

            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_EPISODE, out id))
            {
                TvdbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_EPISODE, out id))
            {
                MovieDbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_EPISODE, out id))
            {
                TvMazeId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_EPISODE, out id))
            {
                TvRageId = Convert.ToInt32(id);
            }
            MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_EPISODE, out ImdbId);

            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
            {
                SeriesTvdbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
            {
                SeriesMovieDbId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_SERIES, out id))
            {
                SeriesTvMazeId = Convert.ToInt32(id);
            }
            if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_SERIES, out id))
            {
                SeriesTvRageId = Convert.ToInt32(id);
            }
            MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_SERIES, out SeriesImdbId);
            MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_SERIES, out SeriesNameId);

            //Brownard 17.06.2016
            //The returned type of the collection differs on the server and client.
            //On the server it's an object collection but on the client it's a string collection due to [de]serialization.
            //Use the non generic Ienumerable to allow for both types.
            IEnumerable collection;

            Actors.Clear();
            if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_ACTORS, out collection))
            {
                Actors.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                    Name = s, Occupation = PersonAspect.OCCUPATION_ACTOR, MediaName = EpisodeName.Text, ParentMediaName = SeriesName.Text
                }));
            }
            foreach (PersonInfo actor in Actors)
            {
                actor.AssignNameId();
            }

            Directors.Clear();
            if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_DIRECTORS, out collection))
            {
                Directors.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                    Name = s, Occupation = PersonAspect.OCCUPATION_DIRECTOR, MediaName = EpisodeName.Text, ParentMediaName = SeriesName.Text
                }));
            }
            foreach (PersonInfo director in Directors)
            {
                director.AssignNameId();
            }

            Writers.Clear();
            if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_WRITERS, out collection))
            {
                Writers.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                    Name = s, Occupation = PersonAspect.OCCUPATION_WRITER, MediaName = EpisodeName.Text, ParentMediaName = SeriesName.Text
                }));
            }
            foreach (PersonInfo writer in Writers)
            {
                writer.AssignNameId();
            }

            Characters.Clear();
            if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_CHARACTERS, out collection))
            {
                Characters.AddRange(collection.Cast <string>().Select(s => new CharacterInfo {
                    Name = s, MediaName = EpisodeName.Text, ParentMediaName = SeriesName.Text
                }));
            }
            foreach (CharacterInfo character in Characters)
            {
                character.AssignNameId();
            }

            Genres.Clear();
            IList <MultipleMediaItemAspect> genreAspects;

            if (MediaItemAspect.TryGetAspects(aspectData, GenreAspect.Metadata, out genreAspects))
            {
                foreach (MultipleMediaItemAspect genre in genreAspects)
                {
                    Genres.Add(new GenreInfo
                    {
                        Id   = genre.GetAttributeValue <int?>(GenreAspect.ATTR_ID),
                        Name = genre.GetAttributeValue <string>(GenreAspect.ATTR_GENRE)
                    });
                }
            }

            EpisodeNumbers.Clear();
            if (MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_EPISODE, out collection))
            {
                CollectionUtils.AddAll(EpisodeNumbers, collection.Cast <int>());
            }

            DvdEpisodeNumbers.Clear();
            if (MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_DVDEPISODE, out collection))
            {
                DvdEpisodeNumbers.AddRange(collection.Cast <double>());
            }

            byte[] data;
            if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
            {
                HasThumbnail = true;
            }

            if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
            {
                Languages.Clear();
                IList <MultipleMediaItemAspect> audioAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                {
                    foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                    {
                        string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                        if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                        {
                            Languages.Add(language);
                        }
                    }
                }
            }
            return(true);
        }
Exemplo n.º 9
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            GetMetadataChanged(aspectData);

            if (aspectData.ContainsKey(MovieAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_RECORDINGTIME, out ReleaseDate);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_TAGLINE, out Tagline);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_CERTIFICATION, out Certification);

                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_RUNTIME_M, out Runtime);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_BUDGET, out Budget);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_REVENUE, out Revenue);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_POPULARITY, out Popularity);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_SCORE, out Score);

                double?rating;
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_TOTAL_RATING, out rating);
                int?voteCount;
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_RATING_COUNT, out voteCount);
                Rating = new SimpleRating(rating, voteCount);

                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_MOVIE_NAME, out tempString);
                MovieName = new SimpleTitle(tempString, false);
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_SORT_TITLE, out tempString);
                MovieNameSort = new SimpleTitle(tempString, false);
                MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_STORYPLOT, out tempString);
                Summary = new SimpleTitle(tempString, false);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_COLLECTION_NAME, out tempString);
                CollectionName = new SimpleTitle(tempString, false);
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_ORIG_MOVIE_NAME, out tempString);
                OriginalName = tempString;

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_MOVIE, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_ALLOCINE, ExternalIdentifierAspect.TYPE_MOVIE, out id))
                {
                    AllocinebId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_CINEPASSION, ExternalIdentifierAspect.TYPE_MOVIE, out id))
                {
                    CinePassionId = Convert.ToInt32(id);
                }

                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_COLLECTION, out id))
                {
                    CollectionMovieDbId = Convert.ToInt32(id);
                }

                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_MOVIE, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_MOVIE, out NameId);

                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_COLLECTION, out CollectionNameId);

                //Brownard 17.06.2016
                //The returned type of the collection differs on the server and client.
                //On the server it's an object collection but on the client it's a string collection due to [de]serialization.
                //Use the non generic Ienumerable to allow for both types.
                IEnumerable collection;
                Actors.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_ACTORS, out collection))
                {
                    Actors.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                        Name = s, Occupation = PersonAspect.OCCUPATION_ACTOR, MediaName = MovieName.Text
                    }));
                }
                foreach (PersonInfo actor in Actors)
                {
                    actor.AssignNameId();
                }

                Directors.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_DIRECTORS, out collection))
                {
                    Directors.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                        Name = s, Occupation = PersonAspect.OCCUPATION_DIRECTOR, MediaName = MovieName.Text
                    }));
                }
                foreach (PersonInfo director in Directors)
                {
                    director.AssignNameId();
                }

                Writers.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_WRITERS, out collection))
                {
                    Writers.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                        Name = s, Occupation = PersonAspect.OCCUPATION_WRITER, MediaName = MovieName.Text
                    }));
                }
                foreach (PersonInfo writer in Writers)
                {
                    writer.AssignNameId();
                }

                Characters.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, VideoAspect.ATTR_CHARACTERS, out collection))
                {
                    Characters.AddRange(collection.Cast <string>().Select(s => new CharacterInfo {
                        Name = s, MediaName = MovieName.Text
                    }));
                }
                foreach (CharacterInfo character in Characters)
                {
                    character.AssignNameId();
                }

                Genres.Clear();
                IList <MultipleMediaItemAspect> genreAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, GenreAspect.Metadata, out genreAspects))
                {
                    foreach (MultipleMediaItemAspect genre in genreAspects)
                    {
                        Genres.Add(new GenreInfo
                        {
                            Id   = genre.GetAttributeValue <int?>(GenreAspect.ATTR_ID),
                            Name = genre.GetAttributeValue <string>(GenreAspect.ATTR_GENRE)
                        });
                    }
                }

                Awards.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_AWARDS, out collection))
                {
                    Awards.AddRange(collection.Cast <string>());
                }

                ProductionCompanies.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_COMPANIES, out collection))
                {
                    ProductionCompanies.AddRange(collection.Cast <string>().Select(s => new CompanyInfo {
                        Name = s, Type = CompanyAspect.COMPANY_PRODUCTION
                    }));
                }
                foreach (CompanyInfo company in ProductionCompanies)
                {
                    company.AssignNameId();
                }

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                return(true);
            }
            else if (aspectData.ContainsKey(MediaAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_TITLE, out tempString);
                MovieName = new SimpleTitle(tempString, false);

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_MOVIE, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_ALLOCINE, ExternalIdentifierAspect.TYPE_MOVIE, out id))
                {
                    AllocinebId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_CINEPASSION, ExternalIdentifierAspect.TYPE_MOVIE, out id))
                {
                    CinePassionId = Convert.ToInt32(id);
                }

                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_COLLECTION, out id))
                {
                    CollectionMovieDbId = Convert.ToInt32(id);
                }

                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_MOVIE, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_MOVIE, out NameId);

                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_COLLECTION, out CollectionNameId);

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 10
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            GetMetadataChanged(aspectData);

            if (aspectData.ContainsKey(SeriesAspect.ASPECT_ID))
            {
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_ORIG_SERIES_NAME, out OriginalName);
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_RECORDINGTIME, out FirstAired);
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_CERTIFICATION, out Certification);
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_ENDED, out IsEnded);

                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_POPULARITY, out Popularity);
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_SCORE, out Score);

                double?rating;
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_TOTAL_RATING, out rating);
                int?voteCount;
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_RATING_COUNT, out voteCount);
                Rating = new SimpleRating(rating, voteCount);

                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_SERIES_NAME, out tempString);
                SeriesName = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_SORT_TITLE, out tempString);
                SeriesNameSort = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));
                MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_DESCRIPTION, out tempString);
                Description = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));

                int?count;
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NUM_SEASONS, out count))
                {
                    TotalSeasons = count.Value;
                }
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NUM_EPISODES, out count))
                {
                    TotalEpisodes = count.Value;
                }

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvdbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvMazeId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvRageId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_SERIES, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_SERIES, out NameId);

                //Brownard 17.06.2016
                //The returned type of the collection differs on the server and client.
                //On the server it's an object collection but on the client it's a string collection due to [de]serialization.
                //Use the non generic Ienumerable to allow for both types.
                IEnumerable collection;

                Actors.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_ACTORS, out collection))
                {
                    Actors.AddRange(collection.Cast <string>().Select(s => new PersonInfo {
                        Name = s, Occupation = PersonAspect.OCCUPATION_ACTOR, ParentMediaName = SeriesName.Text
                    }));
                }
                foreach (PersonInfo actor in Actors)
                {
                    actor.AssignNameId();
                }

                Characters.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_CHARACTERS, out collection))
                {
                    Characters.AddRange(collection.Cast <string>().Select(s => new CharacterInfo {
                        Name = s, ParentMediaName = SeriesName.Text
                    }));
                }
                foreach (CharacterInfo character in Characters)
                {
                    character.AssignNameId();
                }

                Genres.Clear();
                IList <MultipleMediaItemAspect> genreAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, GenreAspect.Metadata, out genreAspects))
                {
                    foreach (MultipleMediaItemAspect genre in genreAspects)
                    {
                        Genres.Add(new GenreInfo
                        {
                            Id   = genre.GetAttributeValue <int?>(GenreAspect.ATTR_ID),
                            Name = genre.GetAttributeValue <string>(GenreAspect.ATTR_GENRE)
                        });
                    }
                }

                Awards.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_AWARDS, out collection))
                {
                    Awards.AddRange(collection.Cast <string>().Select(s => s));
                }

                Networks.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NETWORKS, out collection))
                {
                    Networks.AddRange(collection.Cast <string>().Select(s => new CompanyInfo {
                        Name = s, Type = CompanyAspect.COMPANY_TV_NETWORK
                    }));
                }
                foreach (CompanyInfo network in Networks)
                {
                    network.AssignNameId();
                }

                ProductionCompanies.Clear();
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_COMPANIES, out collection))
                {
                    ProductionCompanies.AddRange(collection.Cast <string>().Select(s => new CompanyInfo {
                        Name = s, Type = CompanyAspect.COMPANY_PRODUCTION
                    }));
                }
                foreach (CompanyInfo company in ProductionCompanies)
                {
                    company.AssignNameId();
                }

                DateTime dateNextEpisode;
                if (MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NEXT_AIR_DATE, out dateNextEpisode) && dateNextEpisode > DateTime.Now)
                {
                    NextEpisodeAirDate = dateNextEpisode;
                    MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NEXT_EPISODE_NAME, out tempString);
                    NextEpisodeName = new SimpleTitle(tempString, false);
                    MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NEXT_SEASON, out NextEpisodeSeasonNumber);
                    MediaItemAspect.TryGetAttribute(aspectData, SeriesAspect.ATTR_NEXT_EPISODE, out NextEpisodeNumber);
                }

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                return(true);
            }
            else if (aspectData.ContainsKey(SeasonAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, SeasonAspect.ATTR_SERIES_NAME, out tempString);
                SeriesName = new SimpleTitle(tempString, false);

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvdbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvMazeId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvRageId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_SERIES, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_SERIES, out NameId);

                return(true);
            }
            else if (aspectData.ContainsKey(EpisodeAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, EpisodeAspect.ATTR_SERIES_NAME, out tempString);
                SeriesName = new SimpleTitle(tempString, false);

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvdbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvMazeId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvRageId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_SERIES, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_SERIES, out NameId);

                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                return(true);
            }
            else if (aspectData.ContainsKey(MediaAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_TITLE, out tempString);
                SeriesName = new SimpleTitle(tempString, false);

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvdbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvMazeId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVRAGE, ExternalIdentifierAspect.TYPE_SERIES, out id))
                {
                    TvRageId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_SERIES, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_SERIES, out NameId);

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        public override bool MergeWith(object other, bool overwriteShorterStrings = true, bool updateEpisodeList = false)
        {
            if (other is SeriesInfo series)
            {
                //Reset next episode data because it was already aired
                if (NextEpisodeAirDate.HasValue && NextEpisodeAirDate.Value < DateTime.Now)
                {
                    NextEpisodeAirDate      = null;
                    NextEpisodeNumber       = null;
                    NextEpisodeSeasonNumber = null;
                    NextEpisodeName         = null;
                    HasChanged = true;
                }

                HasChanged |= MetadataUpdater.SetOrUpdateId(ref TvdbId, series.TvdbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref ImdbId, series.ImdbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref MovieDbId, series.MovieDbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref TvMazeId, series.TvMazeId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref TvRageId, series.TvRageId);

                HasChanged |= MetadataUpdater.SetOrUpdateString(ref SeriesName, series.SeriesName, overwriteShorterStrings);
                HasChanged |= MetadataUpdater.SetOrUpdateString(ref OriginalName, series.OriginalName);
                HasChanged |= MetadataUpdater.SetOrUpdateString(ref Description, series.Description, overwriteShorterStrings);
                HasChanged |= MetadataUpdater.SetOrUpdateString(ref Certification, series.Certification);
                HasChanged |= MetadataUpdater.SetOrUpdateString(ref NextEpisodeName, series.NextEpisodeName);

                if (TotalSeasons < series.TotalSeasons)
                {
                    HasChanged   = true;
                    TotalSeasons = series.TotalSeasons;
                }

                if (TotalEpisodes < series.TotalEpisodes)
                {
                    HasChanged    = true;
                    TotalEpisodes = series.TotalEpisodes;
                }

                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref FirstAired, series.FirstAired);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref Popularity, series.Popularity);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref IsEnded, series.IsEnded);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref NextEpisodeAirDate, series.NextEpisodeAirDate);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref NextEpisodeNumber, series.NextEpisodeNumber);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref NextEpisodeSeasonNumber, series.NextEpisodeSeasonNumber);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref Score, series.Score);

                HasChanged |= MetadataUpdater.SetOrUpdateRatings(ref Rating, series.Rating);
                if (Genres.Count == 0)
                {
                    HasChanged |= MetadataUpdater.SetOrUpdateList(Genres, series.Genres.Distinct().ToList(), true);
                }
                HasChanged |= MetadataUpdater.SetOrUpdateList(Awards, series.Awards.Distinct().ToList(), true);

                //These lists contain Ids and other properties that are not persisted, so they will always appear changed.
                //So changes to these lists will only be stored if something else has changed.
                MetadataUpdater.SetOrUpdateList(Networks, series.Networks.Where(c => !string.IsNullOrEmpty(c.Name)).Distinct().ToList(), Networks.Count == 0, overwriteShorterStrings);
                MetadataUpdater.SetOrUpdateList(ProductionCompanies, series.ProductionCompanies.Where(c => !string.IsNullOrEmpty(c.Name)).Distinct().ToList(), ProductionCompanies.Count == 0, overwriteShorterStrings);
                MetadataUpdater.SetOrUpdateList(Actors, series.Actors.Where(p => !string.IsNullOrEmpty(p.Name)).Distinct().ToList(), Actors.Count == 0, overwriteShorterStrings);
                MetadataUpdater.SetOrUpdateList(Characters, series.Characters.Where(p => !string.IsNullOrEmpty(p.Name)).Distinct().ToList(), Characters.Count == 0, overwriteShorterStrings);

                MetadataUpdater.SetOrUpdateList(Seasons, series.Seasons, true, overwriteShorterStrings);

                if (updateEpisodeList) //Comparing all episodes can be quite time consuming
                {
                    //Only allow new episodes if empty. Online sources might have different names for same series so season name would look strange.
                    bool allowAdd = Episodes.Count == 0;
                    for (int matchIndex = 0; matchIndex < series.Episodes.Count; matchIndex++)
                    {
                        int existing = Episodes.IndexOf(series.Episodes[matchIndex]);
                        if (existing >= 0)
                        {
                            //Don't merge with existing specials. They seem to be different on various online sources.
                            if ((Episodes[existing].SeasonNumber.HasValue && Episodes[existing].SeasonNumber.Value > 0) &&
                                (series.Episodes[matchIndex].SeasonNumber.HasValue && series.Episodes[matchIndex].SeasonNumber.Value > 0))
                            {
                                Episodes[existing].MergeWith(series.Episodes[matchIndex], overwriteShorterStrings);
                            }
                        }
                        else if (allowAdd)
                        {
                            Episodes.Add(series.Episodes[matchIndex]);
                        }
                    }
                    Episodes.Sort();
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 12
0
 public override bool FromString(string name)
 {
     CollectionName = name;
     return(true);
 }
Exemplo n.º 13
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            bool success = false;

            GetMetadataChanged(aspectData);

            if (aspectData.ContainsKey(MovieCollectionAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MovieCollectionAspect.ATTR_COLLECTION_NAME, out tempString);
                CollectionName = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));

                int?count;
                if (MediaItemAspect.TryGetAttribute(aspectData, MovieCollectionAspect.ATTR_NUM_MOVIES, out count))
                {
                    TotalMovies = count.Value;
                }

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                success = true;
            }
            else if (aspectData.ContainsKey(MovieAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_COLLECTION_NAME, out tempString);
                CollectionName = new SimpleTitle(tempString, false);

                success = true;
            }
            else if (aspectData.ContainsKey(MediaAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_TITLE, out tempString);
                CollectionName = new SimpleTitle(tempString, false);

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                success = true;
            }

            if (success)
            {
                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                CustomIds.Clear();
                IList <MultipleMediaItemAspect> externalIdAspects;
                if (MediaItemAspect.TryGetAspects(aspectData, ExternalIdentifierAspect.Metadata, out externalIdAspects))
                {
                    foreach (MultipleMediaItemAspect externalId in externalIdAspects)
                    {
                        string source = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_SOURCE);
                        string id     = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_ID);
                        string type   = externalId.GetAttributeValue <string>(ExternalIdentifierAspect.ATTR_TYPE);
                        if (type == ExternalIdentifierAspect.TYPE_COLLECTION)
                        {
                            if (source == ExternalIdentifierAspect.SOURCE_TMDB)
                            {
                                MovieDbId = Convert.ToInt32(id);
                            }
                            else if (source == ExternalIdentifierAspect.SOURCE_NAME)
                            {
                                NameId = id;
                            }
                            else
                            {
                                CustomIds.Add(source, id);
                            }
                        }
                    }
                }
            }
            return(success);
        }
Exemplo n.º 14
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            if (!aspectData.ContainsKey(CompanyAspect.ASPECT_ID))
            {
                return(false);
            }

            GetMetadataChanged(aspectData);

            MediaItemAspect.TryGetAttribute(aspectData, CompanyAspect.ATTR_COMPANY_NAME, out Name);
            MediaItemAspect.TryGetAttribute(aspectData, CompanyAspect.ATTR_COMPANY_TYPE, out Type);

            string tempString;

            MediaItemAspect.TryGetAttribute(aspectData, CompanyAspect.ATTR_DESCRIPTION, out tempString);
            Description = new SimpleTitle(tempString, string.IsNullOrWhiteSpace(tempString));

            if (Type == CompanyAspect.COMPANY_TV_NETWORK)
            {
                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_NETWORK, out id))
                {
                    TvdbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_NETWORK, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_AUDIODB, ExternalIdentifierAspect.TYPE_NETWORK, out id))
                {
                    AudioDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_NETWORK, out id))
                {
                    TvMazeId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_NETWORK, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_MUSICBRAINZ, ExternalIdentifierAspect.TYPE_NETWORK, out MusicBrainzId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_NETWORK, out NameId);
            }
            else
            {
                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVDB, ExternalIdentifierAspect.TYPE_COMPANY, out id))
                {
                    TvdbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_COMPANY, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_AUDIODB, ExternalIdentifierAspect.TYPE_COMPANY, out id))
                {
                    AudioDbId = Convert.ToInt32(id);
                }
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TVMAZE, ExternalIdentifierAspect.TYPE_COMPANY, out id))
                {
                    TvMazeId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_IMDB, ExternalIdentifierAspect.TYPE_COMPANY, out ImdbId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_MUSICBRAINZ, ExternalIdentifierAspect.TYPE_COMPANY, out MusicBrainzId);
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_COMPANY, out NameId);
            }

            byte[] data;
            if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
            {
                HasThumbnail = true;
            }

            return(true);
        }
Exemplo n.º 15
0
        public override bool FromMetadata(IDictionary <Guid, IList <MediaItemAspect> > aspectData)
        {
            GetMetadataChanged(aspectData);

            if (aspectData.ContainsKey(MovieCollectionAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MovieCollectionAspect.ATTR_COLLECTION_NAME, out tempString);
                CollectionName = new SimpleTitle(tempString, false);

                int?count;
                if (MediaItemAspect.TryGetAttribute(aspectData, MovieCollectionAspect.ATTR_NUM_MOVIES, out count))
                {
                    TotalMovies = count.Value;
                }

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_COLLECTION, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_COLLECTION, out NameId);

                byte[] data;
                if (MediaItemAspect.TryGetAttribute(aspectData, ThumbnailLargeAspect.ATTR_THUMBNAIL, out data))
                {
                    HasThumbnail = true;
                }

                return(true);
            }
            else if (aspectData.ContainsKey(MovieAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MovieAspect.ATTR_COLLECTION_NAME, out tempString);
                CollectionName = new SimpleTitle(tempString, false);

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_COLLECTION, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_COLLECTION, out NameId);

                return(true);
            }
            else if (aspectData.ContainsKey(MediaAspect.ASPECT_ID))
            {
                string tempString;
                MediaItemAspect.TryGetAttribute(aspectData, MediaAspect.ATTR_TITLE, out tempString);
                CollectionName = new SimpleTitle(tempString, false);

                string id;
                if (MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_TMDB, ExternalIdentifierAspect.TYPE_COLLECTION, out id))
                {
                    MovieDbId = Convert.ToInt32(id);
                }
                MediaItemAspect.TryGetExternalAttribute(aspectData, ExternalIdentifierAspect.SOURCE_NAME, ExternalIdentifierAspect.TYPE_COLLECTION, out NameId);

                if (aspectData.ContainsKey(VideoAudioStreamAspect.ASPECT_ID))
                {
                    Languages.Clear();
                    IList <MultipleMediaItemAspect> audioAspects;
                    if (MediaItemAspect.TryGetAspects(aspectData, VideoAudioStreamAspect.Metadata, out audioAspects))
                    {
                        foreach (MultipleMediaItemAspect audioAspect in audioAspects)
                        {
                            string language = audioAspect.GetAttributeValue <string>(VideoAudioStreamAspect.ATTR_AUDIOLANGUAGE);
                            if (!string.IsNullOrEmpty(language) && !Languages.Contains(language))
                            {
                                Languages.Add(language);
                            }
                        }
                    }
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 16
0
        public override bool MergeWith(object other, bool overwriteShorterStrings = true, bool updatePrimaryChildList = false)
        {
            if (other is EpisodeInfo episode)
            {
                bool forceMerge = false;
                //Merge of single and multi-episode needs to force overwrite of properties
                if (EpisodeNumbers.Count == 1 && episode.EpisodeNumbers.Count > 1)
                {
                    forceMerge = true;
                }

                HasChanged |= MetadataUpdater.SetOrUpdateId(ref ImdbId, episode.ImdbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref MovieDbId, episode.MovieDbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref TvdbId, episode.TvdbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref TvMazeId, episode.TvMazeId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref TvRageId, episode.TvRageId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref CustomIds, episode.CustomIds);

                HasChanged |= MetadataUpdater.SetOrUpdateId(ref SeriesImdbId, episode.SeriesImdbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref SeriesMovieDbId, episode.SeriesMovieDbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref SeriesTvdbId, episode.SeriesTvdbId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref SeriesTvMazeId, episode.SeriesTvMazeId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref SeriesTvRageId, episode.SeriesTvRageId);
                HasChanged |= MetadataUpdater.SetOrUpdateId(ref CustomSeriesIds, episode.CustomSeriesIds);

                if (forceMerge)
                {
                    //Merge of single and multi-episode needs to force overwrite of name and summery
                    EpisodeName = episode.EpisodeName;
                    Summary     = episode.Summary;
                    HasChanged  = true;
                }
                else
                {
                    HasChanged |= MetadataUpdater.SetOrUpdateString(ref EpisodeName, episode.EpisodeName, overwriteShorterStrings);
                    HasChanged |= MetadataUpdater.SetOrUpdateString(ref Summary, episode.Summary, overwriteShorterStrings);
                }
                HasChanged |= MetadataUpdater.SetOrUpdateString(ref SeriesName, episode.SeriesName, overwriteShorterStrings);

                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref FirstAired, episode.FirstAired);
                HasChanged |= MetadataUpdater.SetOrUpdateValue(ref SeasonNumber, episode.SeasonNumber);
                MetadataUpdater.SetOrUpdateValue(ref SeriesFirstAired, episode.SeriesFirstAired);

                HasChanged |= MetadataUpdater.SetOrUpdateRatings(ref Rating, episode.Rating);

                if (EpisodeNumbers.Count == 0 || forceMerge)
                {
                    HasChanged |= MetadataUpdater.SetOrUpdateList(EpisodeNumbers, episode.EpisodeNumbers.Distinct().ToList(), true);
                }
                if (DvdEpisodeNumbers.Count == 0 || forceMerge)
                {
                    HasChanged |= MetadataUpdater.SetOrUpdateList(DvdEpisodeNumbers, episode.DvdEpisodeNumbers.Distinct().ToList(), true);
                }
                if (Genres.Count == 0)
                {
                    HasChanged |= MetadataUpdater.SetOrUpdateList(Genres, episode.Genres.Distinct().ToList(), true);
                }

                if (!HasThumbnail && episode.HasThumbnail)
                {
                    Thumbnail  = episode.Thumbnail;
                    HasChanged = true;
                }

                //These lists contain Ids and other properties that are not persisted, so they will always appear changed.
                //So changes to these lists will only be stored if something else has changed.
                MetadataUpdater.SetOrUpdateList(Actors, episode.Actors.Where(p => !string.IsNullOrEmpty(p.Name)).Distinct().ToList(), Actors.Count == 0, overwriteShorterStrings);
                MetadataUpdater.SetOrUpdateList(Characters, episode.Characters.Where(p => !string.IsNullOrEmpty(p.Name)).Distinct().ToList(), Characters.Count == 0, overwriteShorterStrings);
                MetadataUpdater.SetOrUpdateList(Directors, episode.Directors.Where(p => !string.IsNullOrEmpty(p.Name)).Distinct().ToList(), Directors.Count == 0, overwriteShorterStrings);
                MetadataUpdater.SetOrUpdateList(Writers, episode.Writers.Where(p => !string.IsNullOrEmpty(p.Name)).Distinct().ToList(), Writers.Count == 0, overwriteShorterStrings);

                MergeDataProviders(episode);
                return(true);
            }
            return(false);
        }