Exemple #1
0
        protected void ParseProviderLinks(T item, string xml)
        {
            if (ProviderIdParsers.TryFindImdbId(xml, out var imdbId))
            {
                item.SetProviderId(MetadataProvider.Imdb, imdbId.ToString());
            }

            if (item is Movie)
            {
                if (ProviderIdParsers.TryFindTmdbMovieId(xml, out var tmdbId))
                {
                    item.SetProviderId(MetadataProvider.Tmdb, tmdbId.ToString());
                }
            }

            if (item is Series)
            {
                if (ProviderIdParsers.TryFindTmdbSeriesId(xml, out var tmdbId))
                {
                    item.SetProviderId(MetadataProvider.Tmdb, tmdbId.ToString());
                }

                if (ProviderIdParsers.TryFindTvdbId(xml, out var tvdbId))
                {
                    item.SetProviderId(MetadataProvider.Tvdb, tvdbId.ToString());
                }
            }
        }
 public void FindTmdbMovieId_Invalid_Success(string text)
 {
     Assert.False(ProviderIdParsers.TryFindTmdbMovieId(text, out _));
 }
 public void FindTmdbMovieId_Valid_Success(string text, string expected)
 {
     Assert.True(ProviderIdParsers.TryFindTmdbMovieId(text, out ReadOnlySpan <char> parsedId));
     Assert.Equal(expected, parsedId.ToString());
 }