https://github.com/steinitzu/gnarly-tvdb
A simple python interface to thetvdb programmer's api.
https://github.com/steinitzu/gnarly-tvdb
Last synced: 3 months ago
JSON representation
A simple python interface to thetvdb programmer's api.
- Host: GitHub
- URL: https://github.com/steinitzu/gnarly-tvdb
- Owner: steinitzu
- Created: 2013-01-13T06:11:17.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-01-29T05:22:34.000Z (over 12 years ago)
- Last Synced: 2025-02-14T21:04:11.464Z (3 months ago)
- Language: Python
- Size: 146 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog
Awesome Lists containing this project
README
# gnarlytvdb (python) #
This is yet another python interface to [thetvdb.com](http://thetvdb.com) programmer's api.
Its aim is to be fast, simple to use and easy to understand.## Features ##
* String values from TVDB are (mostly) converted to the appropriate python datatypes
* In memory and on disk caching
* Look up a series by imdb id
* Supports aired and DVD ordering for seasons and episodes## Install from pypi ##
gnarlytvdb is on pypi and can be easily install using pip.
If you don't have pip, see install instructions [here](http://www.pip-installer.org/en/latest/installing.html) or see if it is available through your distro's package management system (e.g. apt-get install python-pip).
After you have installed pip you can go ahead and install gnarlytvdb with the following command:pip install gnarlytvdb
(you may need to add sudo in front of that command)
That's it.## Install from source ##
If you prefer to get the latest changes from the source repo, here is how.Start by cloning the repo.
cd /tmp
git clone git://github.com/steinitzu/gnarly-tvdb.git
cd to the projects root foldercd gnarly-tvdb
now install (you may need to add `sudo` in front of the next command)python setup.py install
That's it!
Now lets move on and see how to use this thing.## Basic usage ##
The main component of gnarlytvdb is the `TVDB` class.
Note if you don't already have a tvdb api key for your application, you can register for one [here](http://thetvdb.com/?tab=apiregister).So lets start by opening a TVDB instance.
>> from gnarlytvdb import TVDB
>> tv = TVDB(api_key='my_api_key')
Other available arguments for `TVDB` are documented in the class' docstring.Now we can get our selves some data from thetvdb.
>> series = tv['seinfeld']
or>> series = tv.get_series('seinfeld')
Series becomes an object of the `Series` class.
It is a dict based class and each instance of it will represent a XML element from thetvdb XML api for the requested series. Keys are converted to lower case however.When you fetch a series using the above mentioned methods, all the child episode text data is fetched as well.
So, say you want to see the name of episode 5x4>> print series.season(5).episode(4)['episodename']
The sniffing Accountant
Or you want to see when Seinfeld first aired>> print series['firstaired']
1990-05-31It is also possible to get episodes in their DVD release order by setting the `order` argument to 'dvd'.
Example:>> print series.season(2).episode(12)['episodename']
The Busboy
>> print series.season(2, order='dvd').episode(12)['episodename']
The Revenge
Please feel free to contact me with any questions, comments, bug reports, hatemail, loveletters, etc, either in the project's bugtracker https://github.com/steinitzu/gnarly-tvdb/issues or at [email protected]
* TODO: Implement actors and banners