TMDbLib/Readme.md

157 lines
6.1 KiB
Markdown
Raw Normal View History

2016-11-30 19:27:08 +00:00
TMDbLib [![Build status](https://ci.appveyor.com/api/projects/status/t7wph9cawrl9qho0?svg=true)](https://ci.appveyor.com/project/LordMike/tmdblib) [![NuGet](https://img.shields.io/nuget/v/Tmdblib.svg)](https://www.nuget.org/packages/Tmdblib)
2013-02-16 20:04:49 +00:00
=======
2013-02-16 20:05:40 +00:00
A near-complete wrapper for v3 of TMDb's API (TheMovieDb - https://www.themoviedb.org/).
2013-02-16 20:04:49 +00:00
Nuget
-----
Install from Nuget using the command: **Install-Package TMDbLib**
View more about that here: http://nuget.org/packages/TMDbLib/
2013-02-16 20:04:49 +00:00
2016-08-01 21:01:33 +00:00
Index
2013-02-16 20:04:49 +00:00
---------
2016-08-01 21:01:33 +00:00
- [Nuget](#nuget)
2016-11-30 19:18:20 +00:00
- [Documentation](#documentation)
2016-08-01 21:01:33 +00:00
- [Examples](#examples)
2016-08-02 19:40:41 +00:00
- [Tips](#tips)
2016-08-01 21:01:33 +00:00
- [Changelog](#changelog)
2013-02-16 20:04:49 +00:00
2016-11-30 19:18:20 +00:00
Documentation
--------
Most of the library is self-explaining, and closely follows the possibilities at the official TMDb documentation site: [developers.themoviedb.org](https://developers.themoviedb.org/3/getting-started).
2013-02-16 20:04:49 +00:00
Examples
--------
2013-02-16 20:04:49 +00:00
Simple example, getting the basic info for "A good day to die hard".
TMDbClient client = new TMDbClient("APIKey");
Movie movie = client.GetMovieAsync(47964).Result;
2013-02-16 20:04:49 +00:00
Console.WriteLine($"Movie name: {movie.Title}");
2013-02-16 20:04:49 +00:00
Using the extra features of TMDb, we can fetch more info in one go (here we fetch casts as well as trailers):
TMDbClient client = new TMDbClient("APIKey");
Movie movie = client.GetMovie(47964, MovieMethods.Casts | MovieMethods.Trailers);
Console.WriteLine($"Movie title: {movie.Title}");
foreach (Cast cast in movie.Credits.Cast)
Console.WriteLine($"{cast.Name} - {cast.Character}");
2013-02-16 20:04:49 +00:00
Console.WriteLine();
foreach (Video video in movie.Videos.Results)
Console.WriteLine($"Trailer: {video.Type} ({video.Site}), {video.Name}");
2013-02-16 20:04:49 +00:00
It is likewise simple to search for people or movies, for example here we search for "007". This yields basically every James Bond film ever made:
TMDbClient client = new TMDbClient("APIKey");
SearchContainer<SearchMovie> results = client.SearchMovieAsync("007").Result;
Console.WriteLine($"Got {results.Results.Count:N0} of {results.TotalResults:N0} results");
2013-02-16 20:04:49 +00:00
foreach (SearchMovie result in results.Results)
Console.WriteLine(result.Title);
However, another way to get all James Bond movies, is to use the collection-approach. TMDb makes collections for series of movies, such as Die Hard and James Bond. I know there is one, so I will show how to search for the collection, and then list all movies in it:
TMDbClient client = new TMDbClient("APIKey");
SearchContainer<SearchCollection> collectons = client.SearchCollectionAsync("James Bond").Result;
Console.WriteLine($"Got {collectons.Results.Count:N0} collections");
Collection jamesBonds = client.GetCollectionAsync(collectons.Results.First().Id).Result;
Console.WriteLine($"Collection: {jamesBonds.Name}" );
Console.WriteLine();
Console.WriteLine($"Got {jamesBonds.Parts.Count:N0} James Bond Movies");
foreach (SearchMovie part in jamesBonds.Parts)
2013-02-16 20:04:49 +00:00
Console.WriteLine(part.Title);
2016-08-02 19:40:41 +00:00
Tips
---------
* All methods are `async` and awaitable
* Most methods are very straightforward, and do as they are named, `GetMovie`, `GetPerson` etc.
2016-08-02 19:41:47 +00:00
* Almost all enums are of the `[Flags]` type. This means you can combine them: `MovieMethods.Casts | MovieMethods.Trailers`
2016-08-02 19:40:41 +00:00
* TMDb are big fans of serving as little as possible, so most properties on primary classes like `Movie` are null, until you request the extra data using the enums like above.
2016-08-01 21:01:33 +00:00
Changelog
---------
2017-05-23 18:48:54 +00:00
**1.0.6-alpha**
Changes:
2017-05-25 09:15:30 +00:00
- Added gender to cast and crew for TV shows
- Added recommendations for tvshows and movies
2017-05-23 18:48:54 +00:00
2017-02-27 19:15:58 +00:00
**1.0.5-alpha**
Changes:
- Added `Rating` to `AccountGetRatedMoviesAsync` results
2017-01-19 16:49:48 +00:00
**1.0.4-alpha**
Changes:
- Implemented `Serialize()` for a number of custom serializers
- Implemented `destroyed` Changes action
- Added ability to pass a WebProxy to the TMDbClient
2016-10-27 17:15:25 +00:00
**1.0.0**
No changes. We finally moved to the first stable release in over a year. Compare to `0.8.3`, there will be some breaking changes - but most should be trivial to fix.
2016-08-10 21:22:17 +00:00
**0.9.6-alpha**
Changes:
- Added UAP10.0 as a target
- Changed netstandard1.6 target to netstandard1.0
2016-08-09 20:11:49 +00:00
**0.9.5-alpha**
Changes:
- ChangeItem has been refactored into separate types for each of the applicable actions (#197)
2016-08-09 21:02:15 +00:00
- Created a new object for Episodes of a TvSeason
2016-08-09 21:19:55 +00:00
- More cleanup of types, removing unset properties and adding missing ones
- Adjust the AccountStates object for TvEpisodes in particular, so the properties match returned values from TMDb
2016-08-09 20:11:49 +00:00
2016-08-08 21:36:26 +00:00
**0.9.4-alpha**
Changes:
- Refining tests revealed a number of mismatches between the API and the library. These are fixed as I go along
- A number of types will have moved namespaces, and properties have been added / removed
2016-08-01 21:01:33 +00:00
**0.9.2-alpha**
Changes:
- Combined a number of classes (#195)
- Drastically improved the SearchMulti method (#145)
- Used Newtonsoft.Json tricks to deserialize JSON into multiple different types
**0.9.1-alpha**
Changes:
- Changed project to a .NET Core project (#188), changes required:
- Removed the [Display] attribute, replaced with custom attribute
- Changed StringComparison.InvariantCultureIgnoreCase to OrdinalIgnoreCase
- Removed [Serializable]
- Support `net45` and `netcoreapp1.0` (also added `net451`, `net452`, `net46` and `netstandard1.6`)
- Removed ObjectHelper
- Upgraded to `Newtonsoft.Json 9.0.1` to support `netcoreapp1.0`
**0.9.0-alpha**
- Removed Restsharp in favour of HttpClient and Json.Net
- Fixes a lot of weirdness in Json parsing and gives flexibility
- Simplified retry logic
- Brings the API up to date
- Broke up Tv shows and Movie methods
- Refactorings in code
- Breaking changes, mostly renames and splitting methods
- Async support
**0.8.3**
- Major update which brings the API up to date (minus a few features)
- Multiple breaking changes from 0.7, but mostly parameter changes or renames.
- Prepared for a 0.9 release with `Async` support.
**0.7**
- First release
- Available on Nuget
- Basic API design with a great potential for refactoring (be warned on design changes)
- Supports most (if not all) read-only operations (login sessions not supported - yet).