Closed WirlyWirly closed 6 years ago
I was looking through tvdb_api.py and found a round-about way to do this using the search option. I'm still interested for a more straight-forward method, but for those who may be interested here is one solution...
# One Piece Episode 547
>>> t = tvdb_api.Tvdb()
>>> results = t['One Piece'].search(547, key='absoluteNumber')
>>> # We can then list all available keys if we wanted....
>>> results[0].keys()
dict_keys(['absoluteNumber', 'airedEpisodeNumber', 'airedSeason', 'airedSeasonID', 'dvdEpisodeNumber', 'dvdSeason', 'episodeName', 'firstAired', 'id', 'language', 'lastUpdated', 'overview'])
From there we can use any of those keys to get the appropriate value. So if we wanted the season number we would do...
>>> season_number = results[0]['airedSeason']
>>> print(season_number)
15
This method works fine but like I said if there exists a more straight-forward approach I'd be very interested in knowing.
Yep that's the way - search for the episode, ensure there is a single item, and then you have your episode object. Same as used in tvnamer
when trying to find via absolute episode number:
(I'm not quite sure why it handles the if len(sr) > 1:
case like it does - seems a little strange)
I was wondering how I can search for an an episode via its absolute number instead of the usual SxxExx method. Something like...
One Piece Episode 547 t['One Piece']['absolute_number'][547]
I looked at the ReadMe and even tried using dir() to figure this out, but I couldn't find an answer. I use other programs that take advantage of the Absolute Number offered by the API so I know it is available. Thanks in advance!