-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve SearchMulti() #145
Comments
Depends on issue #144 to be completed and merged first. |
using proper inheritance on the returned items would propably be nicer => using SearchMulti should be the same as SearchMovie with a mixed result set |
@danielnachtrub check out the new |
What is the status of this 4 years old ticket?:) I've checked and currently i have only |
There's been no update. Do you have a specific need? As it is now, the SearchMulti's SearchBase type is a base class. You can cast it to one of three different types (https://github.com/LordMike/TMDbLib/blob/51df5d72d948764b2beae4df2f43b5880123faac/TMDbLib/Utilities/Converters/SearchBaseConverter.cs#L31-L44). |
@LordMike - yeah, but have can i do that?
Will clearly not work :) |
Ok, i've found some method to do it :) A little bit hacky but it works;)
|
Well, you can't cast it to a Movie as that's not the type. It would be one of So, f.ex.: TMDbClient client = new TMDbClient("12345");
var results = await client.SearchMultiAsync("star wars");
var movies = results.Results.OfType<SearchMovie>().ToList();
var tvs = results.Results.OfType<SearchTv>().ToList();
var persons= results.Results.OfType<SearchPerson>().ToList(); |
This is a tricky one, as Multi-search will return one of three objects (movie, tvshow or person), depending on the result. We might be able to reduce the
SearchMulti
type to only contain the common fields, and then have a property for each of the three types (where one of them will be set with the actual content).Inspired by PR #142
The text was updated successfully, but these errors were encountered: