MCPcopy Create free account
hub / github.com/dbr/tvdb_api / _parseActors

Method _parseActors

tvdb_api.py:1005–1042  ·  view source on GitHub ↗

Parsers actors XML, from http://thetvdb.com/api/[APIKEY]/series/[SERIES ID]/actors.xml Actors are retrieved using t['show name]['_actors'], for example: >>> t = Tvdb(actors = True) >>> actors = t['scrubs']['_actors'] >>> type(actors) <class 'tvdb_api

(self, sid)

Source from the content-addressed store, hash-verified

1003 self._setShowData(sid, "_banners", banners)
1004
1005 def _parseActors(self, sid):
1006 """Parsers actors XML, from
1007 http://thetvdb.com/api/[APIKEY]/series/[SERIES ID]/actors.xml
1008
1009 Actors are retrieved using t['show name]['_actors&#x27;], for example:
1010
1011 >>> t = Tvdb(actors = True)
1012 >>> actors = t['scrubs']['_actors']
1013 >>> type(actors)
1014 <class 'tvdb_api.Actors'>
1015 >>> type(actors[0])
1016 <class 'tvdb_api.Actor'>
1017 >>> actors[0]
1018 <Actor u'John C. McGinley'>
1019 >>> sorted(actors[0].keys())
1020 [u'id', u'image', u'imageAdded', u'imageAuthor', u'lastUpdated', u'name', u'role',
1021 u'seriesId', u'sortOrder']
1022 >>> actors[0]['name']
1023 u'John C. McGinley'
1024 >>> actors[0]['image']
1025 u'http://thetvdb.com/banners/actors/43638.jpg'
1026
1027 Any key starting with an underscore has been processed (not the raw
1028 data from the XML)
1029 """
1030 LOG.debug("Getting actors for %s" % (sid))
1031 actors_resp = self._getetsrc(self.config['url_actorsInfo'] % (sid))
1032
1033 cur_actors = Actors()
1034 for cur_actor_item in actors_resp:
1035 cur_actor = Actor()
1036 for tag, value in cur_actor_item.items():
1037 if value is not None:
1038 if tag == "image":
1039 value = self.config['url_artworkPrefix'] % (value)
1040 cur_actor[tag] = value
1041 cur_actors.append(cur_actor)
1042 self._setShowData(sid, '_actors', cur_actors)
1043
1044 def _getShowData(self, sid, language):
1045 """Takes a series ID, gets the epInfo URL and parses the TVDB

Callers 1

_getShowDataMethod · 0.95

Calls 4

_getetsrcMethod · 0.95
_setShowDataMethod · 0.95
ActorsClass · 0.85
ActorClass · 0.85

Tested by

no test coverage detected