dont call external api if no external api is defined
This commit is contained in:
parent
9dcd961fff
commit
d9a5a75a04
1 changed files with 23 additions and 19 deletions
|
@ -482,18 +482,21 @@ class Item(models.Model):
|
||||||
return streams[0] if streams else None
|
return streams[0] if streams else None
|
||||||
|
|
||||||
def get_posters(self):
|
def get_posters(self):
|
||||||
url = self.prefered_poster_url()
|
|
||||||
external_posters = self.external_data.get('posters', {})
|
|
||||||
services = external_posters.keys()
|
|
||||||
index = []
|
index = []
|
||||||
for service in settings.POSTER_PRECEDENCE:
|
if settings.DATA_SERVICE:
|
||||||
if service in services:
|
url = self.prefered_poster_url()
|
||||||
index.append(service)
|
external_posters = self.external_data.get('posters', {})
|
||||||
for service in services:
|
services = external_posters.keys()
|
||||||
if service not in index:
|
for service in settings.POSTER_PRECEDENCE:
|
||||||
index.append(service)
|
if service in services:
|
||||||
if settings.URL not in index:
|
index.append(service)
|
||||||
index.append(settings.URL)
|
for service in services:
|
||||||
|
if service not in index:
|
||||||
|
index.append(service)
|
||||||
|
if settings.URL not in index:
|
||||||
|
index.append(settings.URL)
|
||||||
|
else:
|
||||||
|
external_posters = []
|
||||||
|
|
||||||
posters = []
|
posters = []
|
||||||
poster = self.path('siteposter.jpg')
|
poster = self.path('siteposter.jpg')
|
||||||
|
@ -1310,14 +1313,15 @@ class Item(models.Model):
|
||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
def prefered_poster_url(self):
|
def prefered_poster_url(self):
|
||||||
external_posters = self.external_data.get('posters', {})
|
if settings.DATA_SERVICE:
|
||||||
service = self.poster_source
|
external_posters = self.external_data.get('posters', {})
|
||||||
if service and service != settings.URL and service in external_posters:
|
service = self.poster_source
|
||||||
return external_posters[service][0]['url']
|
if service and service != settings.URL and service in external_posters:
|
||||||
if not service:
|
return external_posters[service][0]['url']
|
||||||
for service in settings.POSTER_PRECEDENCE:
|
if not service:
|
||||||
if service in external_posters:
|
for service in settings.POSTER_PRECEDENCE:
|
||||||
return external_posters[service][0]['url']
|
if service in external_posters:
|
||||||
|
return external_posters[service][0]['url']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def make_timeline(self):
|
def make_timeline(self):
|
||||||
|
|
Loading…
Reference in a new issue