jellyfin / TMDbLib

C#.Net library for TheMovieDB
MIT License
358 stars 135 forks source link

GetTvGenres() doesn't return all possible genres #148

Closed Venom1991 closed 8 years ago

Venom1991 commented 9 years ago

It returns exactly 15 genres and it seems that some are missing. What I mean is this:

SearchContainer<SearchTv> results = client.SearchTvShow("Star Trek").Result;

List<Genre> genres = client.GetTvGenres().Result.Where(g => results.Results[0].GenreIds.Contains(g.Id)).ToList(); // 10759 - "Action & Adventure" and 18 - "Drama"

TvShow show = client.GetTvShow(results.Results[0].Id).Result; // Genres list: 10759 - "Action & Adventure", 18 - "Drama" and 878 - "Science Fiction"

GetTvGenres() obviously didn't fetch "Science Fiction" for some reason. This results in unexpected search behavior. I'm using version 0.8.3. in which there isn't a Genres list in the SearchTv object. Searching is therefore performed firstly by title and then that result is intersected (by Id property) with the DiscoverTvShows().WhereGenresInclude(/* user selected genres fetched by GetTvGenres() */) result.

Is this by design? It is quite unfathomable that GetTvGenres doesn't return all possible genres, only 15 of them. I'm using the default language, maybe something to do with that?

LordMike commented 9 years ago

Just to be sure. You're talking about the client.GetTvGenres() call?

It in turn invokes the following: http://api.themoviedb.org/3/genre/tv/list?api_key=c6b31...

Which correctly enough returns 15 results. 15 may be too few genres for TV, but it is nonetheless what's returned from TMDb.

Venom1991 commented 9 years ago

Yes, it is client.GetTvGenres().

Where the hell did 878 - "Science Fiction" come from then? How is it fetched? Well, it seems I will have to omit searching series by genres altogether and remain with the title-only search query.

I have another question, a bit unrelated. I don't know if it requires opening a new issue thread. How exactly do I fetch newly released episodes for a given TV show (if it is still in production, of course)? I don't quite understand how GetChangesTv() and GetTvShowChanges() function:

SearchContainer<ChangesListItem> showChanges = client.GetChangesTv(startDate: DateTime.Today.AddDays(-14), endDate: DateTime.Today).Result; // 14 days is the largest possible interval, quite a limitation in its own right but unrelated

ChangesContainer changes;
foreach (var change in showChanges.Results)
{
    changes = client.GetTvShowChanges(change.Id).Result;
    if (changes.Changes.Any())
    {
        // What to do with "Changes"? This I don't quite get.
    }
}
Naliath commented 9 years ago

the changes are all changes to the tv show, since the The MovieDB is user driven it gets quite a few changes, not all relevant to you. If person A decides to change 2 letters in the spanish description that will be a change, new poster added, thats a change, etc.

You want newly released episodes then you have a few options:

Other than that I don't know of a method to get exactly what you are asking

PS: /tv/airing_today will get you all shows airing today, perhaps that could be of some use

Venom1991 commented 9 years ago

This "Added" you are speaking of is in fact a string stored in the Action property of the ChangeItem object or is it something else entirely? So, when Change.Key is "season" or "episode" and ChangeItem.Action is "added" that indicates a new season and/or episode? Well, that is pretty much what I need. The only thing that remains is to parse the ChangeItem.Value JSON string.

LordMike commented 9 years ago

To be honest. The Changes API's have not received a whole lot of attention. So if you find issues (unparsed attributes etc.), do chime in.

@Naliath we should move the TMDbLib.Objects.Movies.Change into TMDbLib.Objects.General (it's apparently used everywhere :P. That and ChangeContainer too.

Naliath commented 9 years ago

@LordMike Yup, I'll take a look at it today, edit: 14220f7220eaceb17078d284ed50c375d418a7d4

@Venom1991 The exact keys and their meaning you will need to lookup in the api docs. In addition to that we might need to submit a bug report that we are not getting all the genres back (original question).

Naliath commented 8 years ago

I don't think there is more to do for this on our end...