summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Wagner <rwagner@mythtv.org>2011-07-12 01:41:56 (GMT)
committer Raymond Wagner <rwagner@mythtv.org>2011-07-12 01:41:56 (GMT)
commit1c34d57bf2b5a862fb12d4e7600a8173cb8bd682 (patch)
treece502c22617f5b639b318d0196b25f885d11d447
parenta38fd4f899c77efb8b135cf5c52e4dc92c98f85b (diff)
Add escaping of periods at the beginning of a movie title, to work
around security mechanism in TMDB API.
-rw-r--r--mythtv/bindings/python/MythTV/tmdb/tmdb_api.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/mythtv/bindings/python/MythTV/tmdb/tmdb_api.py b/mythtv/bindings/python/MythTV/tmdb/tmdb_api.py
index ce8a5cb..92dcaca 100644
--- a/mythtv/bindings/python/MythTV/tmdb/tmdb_api.py
+++ b/mythtv/bindings/python/MythTV/tmdb/tmdb_api.py
@@ -591,7 +591,18 @@ class MovieDb(object):
else:
URL = self.config[u'urls'][u'movie.search']
org_title = title
+
+ # strip out leading periods
+ if title.startswith('.'):
+ prepend = ''
+ for char in title:
+ if char != '.':
+ break
+ prepend += '\.'
+ title = prepend + title.lstrip('.')
+
title = urllib.quote(title.encode("utf-8"))
+
url = URL % (title)
if self.config['debug_enabled']: # URL so that raw TMDB XML data can be viewed in a browser
sys.stderr.write(u'\nDEBUG: XML URL:%s\n\n' % url)