dbr/tvdb_api — pull request #31 by louist87 (2012-12-29 18:12:53+00:00)
Title: Callable interface and Episode.walk method [API Improvements]

**Feature 1: Callable Interfaces**

This feature addresses an inconsistency in the current API design. Indexing `Show`, `Season` and `Episode` does not yield predictable results. In the case of `Show` and `Season`, indexing returns the next object in the *series -> season -> episode* hierarchy. In the case of `Episode`, however, indexing returns associated TVDB data.

The callable interface emulates a `dict.get` call towards the container responsible for TVDB-scraped information. Thus, calling `Show` performs a `Show.data.get` call and calling `Episode` performs an `Episode.get` call. `Series` does not contain any TVDB-scraped data, so calling `Series` returns `None`. This is for consistency.

As per the commit message, this is useful in a variety of circumstances, including mapping a data across several series or episodes:

```python
episodes = [ep1, ep2, ep3, ep4] # tvdb_api.Episode instances
ep_names = map(lambda ep: ep('episodename'), episodes)
```

For instance, in [one of my own projects](https://github.com/louist87/Scrappy), I will be reimplementing a number of functions as callbacks using this behavior

**Feature 2: Episode.walk() Method**

It's sometimes desirable to get series data from an `Episode` instance. `Episode.walk` returns the first value assigned to a particular key, looking first in itself, then in `self.season.show.data`.