mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-02 17:33:37 +00:00
Merge branch 'feature/ChangeTvmazeApiRedirects' into develop
This commit is contained in:
commit
241344b25a
2 changed files with 10 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
||||||
* Update unidecode module 1.0.22 (81f938d) to 1.0.22 (578cdb9)
|
* Update unidecode module 1.0.22 (81f938d) to 1.0.22 (578cdb9)
|
||||||
* Change site services tester to fallback to http if error with SSL
|
* Change site services tester to fallback to http if error with SSL
|
||||||
* Change try to use folder name when filename does not contain show name
|
* Change try to use folder name when filename does not contain show name
|
||||||
|
* Change force redirects in TVMaze API to be https
|
||||||
|
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
|
@ -96,9 +96,18 @@ class TraktDict(OrderedDict):
|
||||||
(self[key], '%07d' % self[key])[key == INDEXER_IMDB])
|
(self[key], '%07d' % self[key])[key == INDEXER_IMDB])
|
||||||
|
|
||||||
|
|
||||||
|
def tvmaze_record_hook(r, *args, **kwargs):
|
||||||
|
r.hook_called = True
|
||||||
|
if 301 == r.status_code and isinstance(r.headers.get('Location'), basestring) \
|
||||||
|
and r.headers.get('Location').startswith('http://api.tvmaze'):
|
||||||
|
r.headers['Location'] = r.headers['Location'].replace('http://', 'https://')
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
def get_tvmaze_data(count=0, *args, **kwargs):
|
def get_tvmaze_data(count=0, *args, **kwargs):
|
||||||
res = None
|
res = None
|
||||||
count += 1
|
count += 1
|
||||||
|
kwargs['hooks'] = {'response': tvmaze_record_hook}
|
||||||
if 3 >= count:
|
if 3 >= count:
|
||||||
try:
|
try:
|
||||||
res = getURL(*args, **kwargs)
|
res = getURL(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue