Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

If a language is configured, always use that, if not, use the selecte…

…d show's language
  • Loading branch information...
commit ba7c14fba643371903399ba604f3b5bf29e53fd2 1 parent 2280e31
@dbr dbr authored
Showing with 22 additions and 7 deletions.
  1. +22 −7 tvdb_api.py
View
29 tvdb_api.py
@@ -359,13 +359,14 @@ def __init__(self,
]
if language is None:
- self.config['language'] = "en"
- elif language not in self.config['valid_languages']:
- raise ValueError("Invalid language %s, options are: %s" % (
- language, self.config['valid_languages']
- ))
+ self.config['language'] = None
else:
- self.config['language'] = language
+ if language not in self.config['valid_languages']:
+ raise ValueError("Invalid language %s, options are: %s" % (
+ language, self.config['valid_languages']
+ ))
+ else:
+ self.config['language'] = language
# The following url_ configs are based of the
# http://thetvdb.com/wiki/index.php/Programmers_API
@@ -635,9 +636,23 @@ def _getShowData(self, sid, language):
shows[series_id][season_number][episode_number]
"""
+ if self.config['language'] is None:
+ self.log.debug('Config language is none, using show langauge')
+ getShowInLanguage = language
+ else:
+ self.log.debug(
+ 'Configured language %s override show language of %s' % (
+ self.config['language'],
+ language
+ )
+ )
+ getShowInLanguage = self.config['language']
+
# Parse show information
self.log.debug('Getting all series data for %s' % (sid))
- seriesInfoEt = self._getetsrc(self.config['url_seriesInfo'] % (sid, language))
+ seriesInfoEt = self._getetsrc(
+ self.config['url_seriesInfo'] % (sid, getShowInLanguage)
+ )
for curInfo in seriesInfoEt.findall("Series")[0]:
tag = curInfo.tag.lower()
value = curInfo.text
Please sign in to comment.
Something went wrong with that request. Please try again.