Skip to content

Commit

Permalink
Add badge and kit placeholder if items not available on thesportsdb -…
Browse files Browse the repository at this point in the history
… Thanks curswine
  • Loading branch information
enen92 committed Sep 16, 2016
1 parent 69efc50 commit 95e770a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Binary file added resources/img/nobadge_placeholder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/img/nokit_placeholder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 13 additions & 6 deletions resources/lib/eventdetails.py
Expand Up @@ -111,8 +111,12 @@ def setEventDetails(self):
if self.match.HomeTeamObj:
if self.match.HomeTeamObj.strTeamBadge:
self.getControl(32501).setImage(self.match.HomeTeamObj.strTeamBadge)
else:
self.getControl(32501).setImage(os.path.join(addon_path,"resources","img","nobadge_placeholder.png"))
if self.match.HomeTeamObj.strTeamJersey:
self.getControl(32502).setImage(self.match.HomeTeamObj.strTeamJersey)
else:
self.getControl(32502).setImage(os.path.join(addon_path,"resources","img","nokit_placeholder.png"))

self.getControl(32503).setLabel(self.match.HomeTeam)
self.getControl(32506).setLabel(self.match.AwayTeam)
Expand All @@ -123,8 +127,12 @@ def setEventDetails(self):
if self.match.AwayTeamObj:
if self.match.AwayTeamObj.strTeamBadge:
self.getControl(32504).setImage(self.match.AwayTeamObj.strTeamBadge)
else:
self.getControl(32504).setImage(os.path.join(addon_path,"resources","img","nobadge_placeholder.png"))
if self.match.AwayTeamObj.strTeamJersey:
self.getControl(32505).setImage(self.match.AwayTeamObj.strTeamJersey)
else:
self.getControl(32505).setImage(os.path.join(addon_path,"resources","img","nokit_placeholder.png"))

if matchHomeGoals and matchAwayGoals:
self.getControl(32507).setLabel(str(matchHomeGoals)+"-"+str(matchAwayGoals))
Expand Down Expand Up @@ -289,8 +297,7 @@ def setLineUps(self,team):
if self.LineUpTeamObj.strTeamBadge:
self.getControl(32520).setImage(self.LineUpTeamObj.strTeamBadge)
else:
#TODO placeholder
self.getControl(32520).setImage("")
self.getControl(32520).setImage(os.path.join(addon_path,"resources","img","nobadge_placeholder.png"))

#Set team formation label
if self.formationlabel:
Expand Down Expand Up @@ -365,7 +372,7 @@ def setLineUps(self,team):
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, self.LineUpTeamObj.strTeamJersey )
self.controls.append(image)
else:
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, "" )
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, os.path.join(addon_path,"resources","img","nokit_placeholder.png") )
label = positions.getLabel(image, "[B]" + self.lineupgoalkeeper + "[/B]")
self.controls.append(label)
#defenders
Expand All @@ -380,7 +387,7 @@ def setLineUps(self,team):
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, self.LineUpTeamObj.strTeamJersey)
self.controls.append(image)
else:
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, "" )
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, os.path.join(addon_path,"resources","img","nokit_placeholder.png") )
label = positions.getLabel(image,"[B]" + self.lineupdefenders[i] + "[/B]")
self.controls.append(label)
i += 1
Expand All @@ -396,7 +403,7 @@ def setLineUps(self,team):
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, self.LineUpTeamObj.strTeamJersey)
self.controls.append(image)
else:
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, "" )
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, os.path.join(addon_path,"resources","img","nokit_placeholder.png") )
label = positions.getLabel(image,"[B]" + self.lineupmidfielders[i] + "[/B]")
self.controls.append(label)
i += 1
Expand All @@ -412,7 +419,7 @@ def setLineUps(self,team):
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, self.LineUpTeamObj.strTeamJersey)
self.controls.append(image)
else:
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, "" )
image = xbmcgui.ControlImage(image_x,image_y,image_size,image_size, os.path.join(addon_path,"resources","img","nokit_placeholder.png") )
label = positions.getLabel(image,"[B]" + self.lineupforwarders[i] + "[/B]")
self.controls.append(label)
i += 1
Expand Down
6 changes: 4 additions & 2 deletions resources/lib/livescores.py
Expand Up @@ -174,10 +174,12 @@ def setLivescores(self):
#set team badge
if livegame.HomeTeamObj and livegame.HomeTeamObj.strTeamBadge:
item.setProperty('home_team_logo',livegame.HomeTeamObj.strTeamBadge)
#else: placeholder
else:
item.setProperty('home_team_logo',os.path.join(addon_path,"resources","img","nobadge_placeholder.png"))
if livegame.AwayTeamObj and livegame.AwayTeamObj.strTeamBadge:
item.setProperty('away_team_logo',livegame.AwayTeamObj.strTeamBadge)
#else: placeholder
else:
item.setProperty('away_team_logo',os.path.join(addon_path,"resources","img","nobadge_placeholder.png"))

if livegame.HomeGoals and bool(int(livegame.HomeGoals)>0):
item.setProperty('has_home_goals',os.path.join(addon_path,"resources","img","goal.png"))
Expand Down

0 comments on commit 95e770a

Please sign in to comment.