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:47:43 (GMT)
commit254c9f7454155e7d3e38cef0bf56c5f9cbca49c2 (patch)
tree25a5474094fd92a166e175d900136aaf8a754350
parent8f8d6620bb3a6d22913521bde86d7677db731b4e (diff)
Add escaping of periods at the beginning of a movie title, to work
around security mechanism in TMDB API. (cherry picked from commit 1c34d57bf2b5a862fb12d4e7600a8173cb8bd682)
-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 4e00848..c1dd52f 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)