def setLivescores(self):
        items = []
        self.livecopy = []
        if self.livescoresdata:
            for livegame in self.livescoresdata:
                if removeNonAscii(livegame.League).strip().lower() not in str(
                        self.ignored_leagues):

                    #decide to add the match or not
                    if (livegame.Time.lower() != "not started") and (
                            livegame.Time.lower() != "finished") and (
                                livegame.Time.lower() != "postponed"):
                        add = True
                    else:
                        if livegame.Time.lower(
                        ) == "not started" and hide_notstarted == "true":
                            add = False
                        elif livegame.Time.lower(
                        ) == "postponed" and hide_notstarted == "true":
                            add = False
                        elif livegame.Time.lower(
                        ) == "finished" and hide_finished == "true":
                            add = False
                        else:
                            add = True
                    if not livegame.HomeGoals.strip(
                    ) and not livegame.AwayGoals.strip():
                        add = False

                    #Get only the team objects for the games that will be added (avoid unecessary requests)
                    #Append to self.teamObjs
                    if add == True:
                        id_teams = []
                        if livegame.HomeTeam_Id:
                            id_teams.append(livegame.HomeTeam_Id)
                        else:
                            id_teams.append(None)

                        if livegame.AwayTeam_Id:
                            id_teams.append(livegame.AwayTeam_Id)
                        else:
                            id_teams.append(None)

                        index = 0  #To distinguish home (0) from away team (1)
                        for id_team in id_teams:
                            if id_team:
                                update_team_data = True
                                if self.cache_object.isCachedTeam(id_team):
                                    update_team_data = abs(
                                        self.t2 - self.cache_object.
                                        getCachedTeamTimeStamp(id_team)
                                    ) > datetime.timedelta(
                                        hours=self.hoursList[self.interval])

                                if update_team_data:
                                    try:
                                        teamobject = api.Lookups().Team(
                                            teamid=id_team)[0]
                                        self.cache_object.cacheTeam(
                                            teamid=id_team,
                                            team_obj=teamobject)
                                        xbmc.log(
                                            msg=
                                            "[Match Center] Timedelta was reached for team %s new request to be made..."
                                            % (str(id_team)),
                                            level=xbmc.LOGDEBUG)
                                    except:
                                        teamobject = None
                                else:
                                    teamobject = self.cache_object.getcachedTeam(
                                        id_team)
                                    xbmc.log(
                                        msg=
                                        "[Match Center] Used cached data for team %s..."
                                        % (str(id_team)),
                                        level=xbmc.LOGDEBUG)

                                if index == 0:
                                    livegame.setHomeTeamObj(obj=teamobject)
                                else:
                                    livegame.setAwayTeamObj(obj=teamobject)
                            index += 1

                        #if livegame.HomeTeamObj and livegame.AwayTeamObj:
                        item = xbmcgui.ListItem(livegame.HomeTeam +
                                                livegame.AwayTeam)
                        item.setProperty(
                            'result',
                            str(livegame.HomeGoals) + "-" +
                            str(livegame.AwayGoals))

                        #Set team name label
                        hometeamName = livegame.HomeTeam
                        awayteamName = livegame.AwayTeam
                        if show_alternative == "true":
                            if livegame.HomeTeamObj:
                                hometeamName = livegame.HomeTeamObj.AlternativeNameFirst
                            if livegame.AwayTeamObj:
                                awayteamName = livegame.AwayTeamObj.AlternativeNameFirst

                        #Choose between textbox (long names) or label (short names)
                        if len(hometeamName) >= 14 and " " in hometeamName:
                            item.setProperty('hometeam_long', hometeamName)
                        else:
                            item.setProperty('hometeam_short', hometeamName)

                        if len(awayteamName) >= 14 and " " in awayteamName:
                            item.setProperty('awayteam_long', awayteamName)
                        else:
                            item.setProperty('awayteam_short', awayteamName)

                        #set team badge
                        if livegame.HomeTeamObj and livegame.HomeTeamObj.strTeamBadge:
                            item.setProperty('home_team_logo',
                                             livegame.HomeTeamObj.strTeamBadge)
                        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:
                            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"))
                        if livegame.AwayGoals and bool(
                                int(livegame.AwayGoals) > 0):
                            item.setProperty(
                                'has_away_goals',
                                os.path.join(addon_path, "resources", "img",
                                             "goal.png"))
                        if livegame.HomeGoalDetails:
                            item.setProperty('home_goal_details',
                                             livegame.HomeGoalDetails)
                        if livegame.AwayGoalDetails:
                            item.setProperty('away_goal_details',
                                             livegame.AwayGoalDetails)
                        item.setProperty(
                            'league_and_round', livegame.League + ' - ' +
                            translate(32017) + ' ' + livegame.Round)

                        #red cards
                        if livegame.HomeTeamRedCardDetails:
                            home_redcards = livegame.HomeTeamRedCardDetails.split(
                                ";")
                            for redcard in home_redcards:
                                if not redcard: home_redcards.remove(redcard)
                            if len(home_redcards) == 1:
                                item.setProperty(
                                    'home_redcard1',
                                    os.path.join(addon_path, "resources",
                                                 "img", "redcard.png"))
                            elif len(home_redcards) > 1:
                                item.setProperty(
                                    'home_redcard1',
                                    os.path.join(addon_path, "resources",
                                                 "img", "redcard.png"))
                                item.setProperty(
                                    'home_redcard2',
                                    os.path.join(addon_path, "resources",
                                                 "img", "redcard.png"))
                        if livegame.AwayTeamRedCardDetails:
                            away_redcards = livegame.AwayTeamRedCardDetails.split(
                                ";")
                            for redcard in away_redcards:
                                if not redcard: away_redcards.remove(redcard)
                            if len(away_redcards) == 1:
                                item.setProperty(
                                    'away_redcard2',
                                    os.path.join(addon_path, "resources",
                                                 "img", "redcard.png"))
                            elif len(away_redcards) > 1:
                                item.setProperty(
                                    'away_redcard1',
                                    os.path.join(addon_path, "resources",
                                                 "img", "redcard.png"))
                                item.setProperty(
                                    'away_redcard2',
                                    os.path.join(addon_path, "resources",
                                                 "img", "redcard.png"))

                        #Convert event time to user timezone
                        if livegame.Time.lower() == "not started":
                            try:
                                db_time = pytz.timezone(
                                    str(pytz.timezone("Etc/UTC"))).localize(
                                        livegame.DateTime)
                                my_location = pytz.timezone(
                                    pytz.all_timezones[int(my_timezone)])
                                converted_time = db_time.astimezone(
                                    my_location)
                                starttime = converted_time.strftime("%H:%M")
                                item.setProperty('starttime', starttime)
                            except Exception, e:
                                xbmc.log(msg="[Match Center] Exception: %s" %
                                         (str(e)),
                                         level=xbmc.LOGDEBUG)

                        #set match progress
                        matchpercent = "0"
                        if "'" in livegame.Time.lower():
                            try:
                                matchpercent = str(
                                    int((float(livegame.Time.replace("'", ""))
                                         / 90) * 100))
                            except:
                                pass
                        else:
                            if livegame.Time.lower() == "halftime":
                                matchpercent = "50"
                            elif livegame.Time.lower(
                            ) == "postponed" or livegame.Time.lower(
                            ) == "not started":
                                matchpercent = "0"
                            elif livegame.Time.lower() == "finished":
                                matchpercent = "100"
                        item.setProperty("matchpercent", matchpercent)

                        #check match status
                        item.setProperty(
                            'minute',
                            str(ssutils.translatematch(livegame.Time)))
                        if livegame.Time.lower() == "finished":
                            status = os.path.join(addon_path, "resources",
                                                  "img", "redstatus.png")
                        elif "'" in livegame.Time.lower():
                            status = os.path.join(addon_path, "resources",
                                                  "img", "greenstatus.png")
                        else:
                            status = os.path.join(addon_path, "resources",
                                                  "img", "yellowstatus.png")
                        item.setProperty('status', status)
                        items.append(item)

                        self.livecopy.append(livegame)
示例#2
0
    def setLivescores(self):
        items = []
        self.livecopy = []
        if self.livescoresdata:
            for livegame in self.livescoresdata:
                if removeNonAscii(livegame.League) not in str(
                        self.ignored_leagues):
                    #decide to add the match or not
                    if (livegame.Time.lower() != "not started") and (
                            livegame.Time.lower() != "finished") and (
                                livegame.Time.lower() != "postponed"):
                        add = True
                    else:
                        if livegame.Time.lower(
                        ) == "not started" and hide_notstarted == "true":
                            add = False
                        elif livegame.Time.lower(
                        ) == "postponed" and hide_notstarted == "true":
                            add = False
                        elif livegame.Time.lower(
                        ) == "finished" and hide_finished == "true":
                            add = False
                        else:
                            add = True
                    if not livegame.HomeGoals.strip(
                    ) and not livegame.AwayGoals.strip():
                        add = False

                    if add == True:
                        #Get only the team objects for the games that will be added (avoid unecessary requests)
                        #Append to self.teamObjs
                        if not livegame.HomeTeam in self.teamObjs.keys():
                            try:
                                hometeamobj = api.Lookups().Team(
                                    teamid=livegame.HomeTeam_Id)[0]
                                livegame.setHomeTeamObj(hometeamobj)
                                self.teamObjs[livegame.HomeTeam] = hometeamobj
                            except:
                                hometeamobj = None
                        else:
                            hometeamobj = self.teamObjs[livegame.HomeTeam]
                            livegame.setHomeTeamObj(hometeamobj)
                        if not livegame.AwayTeam in self.teamObjs.keys():
                            try:
                                awayteamobj = api.Lookups().Team(
                                    teamid=livegame.AwayTeam_Id)[0]
                                livegame.setAwayTeamObj(awayteamobj)
                                self.teamObjs[livegame.AwayTeam] = awayteamobj
                            except:
                                awayteamobj = None
                        else:
                            awayteamobj = self.teamObjs[livegame.AwayTeam]
                            livegame.setAwayTeamObj(awayteamobj)

                        if awayteamobj and hometeamobj:
                            item = xbmcgui.ListItem(livegame.HomeTeam +
                                                    livegame.AwayTeam)
                            item.setProperty(
                                'result',
                                str(livegame.HomeGoals) + "-" +
                                str(livegame.AwayGoals))

                            #Set team name label
                            if show_alternative == "true":
                                hometeamName = livegame.HomeTeamObj.AlternativeNameFirst
                                awayteamName = livegame.AwayTeamObj.AlternativeNameFirst
                            else:
                                hometeamName = livegame.HomeTeam
                                awayteamName = livegame.AwayTeam

                            #Choose between textbox (long names) or label (short names)
                            if len(hometeamName) > 14 and " " in hometeamName:
                                item.setProperty('hometeam_long', hometeamName)
                            else:
                                item.setProperty('hometeam_short',
                                                 hometeamName)

                            if len(awayteamName) > 14 and " " in awayteamName:
                                item.setProperty('awayteam_long', awayteamName)
                            else:
                                item.setProperty('awayteam_short',
                                                 awayteamName)

                            item.setProperty('home_team_logo',
                                             livegame.HomeTeamObj.strTeamBadge)
                            item.setProperty('away_team_logo',
                                             livegame.AwayTeamObj.strTeamBadge)
                            if livegame.HomeGoals and bool(
                                    int(livegame.HomeGoals) > 0):
                                item.setProperty(
                                    'has_home_goals',
                                    os.path.join(addon_path, "resources",
                                                 "img", "goal.png"))
                            if livegame.AwayGoals and bool(
                                    int(livegame.AwayGoals) > 0):
                                item.setProperty(
                                    'has_away_goals',
                                    os.path.join(addon_path, "resources",
                                                 "img", "goal.png"))
                            if livegame.HomeGoalDetails:
                                item.setProperty('home_goal_details',
                                                 livegame.HomeGoalDetails)
                            if livegame.AwayGoalDetails:
                                item.setProperty('away_goal_details',
                                                 livegame.AwayGoalDetails)
                            item.setProperty(
                                'league_and_round', livegame.League + ' - ' +
                                translate(32017) + ' ' + livegame.Round)

                            #red cards
                            if livegame.HomeTeamRedCardDetails:
                                home_redcards = livegame.HomeTeamRedCardDetails.split(
                                    ";")
                                for redcard in home_redcards:
                                    if not redcard:
                                        home_redcards.remove(redcard)
                                if len(home_redcards) == 1:
                                    item.setProperty(
                                        'home_redcard1',
                                        os.path.join(addon_path, "resources",
                                                     "img", "redcard.png"))
                                elif len(home_redcards) > 1:
                                    item.setProperty(
                                        'home_redcard1',
                                        os.path.join(addon_path, "resources",
                                                     "img", "redcard.png"))
                                    item.setProperty(
                                        'home_redcard2',
                                        os.path.join(addon_path, "resources",
                                                     "img", "redcard.png"))
                            if livegame.AwayTeamRedCardDetails:
                                away_redcards = livegame.AwayTeamRedCardDetails.split(
                                    ";")
                                for redcard in away_redcards:
                                    if not redcard:
                                        away_redcards.remove(redcard)
                                if len(away_redcards) == 1:
                                    item.setProperty(
                                        'away_redcard1',
                                        os.path.join(addon_path, "resources",
                                                     "img", "redcard.png"))
                                elif len(away_redcards) > 1:
                                    item.setProperty(
                                        'away_redcard1',
                                        os.path.join(addon_path, "resources",
                                                     "img", "redcard.png"))
                                    item.setProperty(
                                        'away_redcard2',
                                        os.path.join(addon_path, "resources",
                                                     "img", "redcard.png"))

                            #Convert event time to user timezone
                            if livegame.Time.lower() == "not started":
                                try:
                                    db_time = pytz.timezone(
                                        str(pytz.timezone(
                                            "Europe/London"))).localize(
                                                livegame.DateTime)
                                    my_location = pytz.timezone(
                                        pytz.all_timezones[int(my_timezone)])
                                    converted_time = db_time.astimezone(
                                        my_location)
                                    starttime = converted_time.strftime(
                                        "%H:%M")
                                    item.setProperty('starttime', starttime)
                                except:
                                    pass

                            #set match progress
                            matchpercent = "0"
                            if "'" in livegame.Time.lower():
                                try:
                                    matchpercent = str(
                                        int((float(
                                            livegame.Time.replace("'", "")) /
                                             90) * 100))
                                except:
                                    pass
                            else:
                                if livegame.Time.lower() == "halftime":
                                    matchpercent = "50"
                                elif livegame.Time.lower(
                                ) == "postponed" or livegame.Time.lower(
                                ) == "not started":
                                    matchpercent = "0"
                                elif livegame.Time.lower() == "finished":
                                    matchpercent = "100"
                            item.setProperty("matchpercent", matchpercent)

                            #check match status
                            item.setProperty(
                                'minute',
                                str(ssutils.translatematch(livegame.Time)))
                            if livegame.Time.lower() == "finished":
                                status = os.path.join(addon_path, "resources",
                                                      "img", "redstatus.png")
                            elif "'" in livegame.Time.lower():
                                status = os.path.join(addon_path, "resources",
                                                      "img", "greenstatus.png")
                            else:
                                status = os.path.join(addon_path, "resources",
                                                      "img",
                                                      "yellowstatus.png")
                            item.setProperty('status', status)
                            items.append(item)

                            self.livecopy.append(livegame)

        self.getControl(32500).reset()
        if items:
            xbmc.executebuiltin("ClearProperty(no-games,Home)")
            self.getControl(32500).addItems(items)
            self.setFocusId(32500)
        else:
            self.set_no_games()
        return
示例#3
0
	def setLivescores(self):
		items = []
		self.livecopy = []
		if self.livescoresdata:
			for livegame in self.livescoresdata:
				if removeNonAscii(livegame.League) not in str(self.ignored_leagues):
					#decide to add the match or not
					if (livegame.Time.lower() != "not started") and (livegame.Time.lower() != "finished") and (livegame.Time.lower() != "postponed"):
						add = True
					else:
						if livegame.Time.lower() == "not started" and hide_notstarted == "true":
							add = False
						elif livegame.Time.lower() == "postponed" and hide_notstarted == "true":
							add = False
						elif livegame.Time.lower() == "finished" and hide_finished == "true":
							add = False
						else:
							add = True
					if not livegame.HomeGoals.strip() and not livegame.AwayGoals.strip():
						add = False
						
					if add == True:
						#Get only the team objects for the games that will be added (avoid unecessary requests)
						#Append to self.teamObjs
						if not livegame.HomeTeam in self.teamObjs.keys():
							try:
								hometeamobj = api.Lookups().Team(teamid=livegame.HomeTeam_Id)[0]
								livegame.setHomeTeamObj(hometeamobj)
								self.teamObjs[livegame.HomeTeam] = hometeamobj
							except:
								hometeamobj = None
						else:
							hometeamobj = self.teamObjs[livegame.HomeTeam]
							livegame.setHomeTeamObj(hometeamobj)
						if not livegame.AwayTeam in self.teamObjs.keys():
							try:
								awayteamobj = api.Lookups().Team(teamid=livegame.AwayTeam_Id)[0]
								livegame.setAwayTeamObj(awayteamobj)
								self.teamObjs[livegame.AwayTeam] = awayteamobj
							except:
								awayteamobj = None
						else:
							awayteamobj = self.teamObjs[livegame.AwayTeam]
							livegame.setAwayTeamObj(awayteamobj)


						if awayteamobj and hometeamobj:
							item = xbmcgui.ListItem(livegame.HomeTeam+livegame.AwayTeam)
							item.setProperty('result',str(livegame.HomeGoals)+"-"+str(livegame.AwayGoals))
							
							#Set team name label
							if show_alternative == "true":
								hometeamName = livegame.HomeTeamObj.AlternativeNameFirst
								awayteamName = livegame.AwayTeamObj.AlternativeNameFirst
							else:
								hometeamName = livegame.HomeTeam
								awayteamName = livegame.AwayTeam

							#Choose between textbox (long names) or label (short names)
							if len(hometeamName) > 14 and " " in hometeamName:
								item.setProperty('hometeam_long',hometeamName)
							else:
								item.setProperty('hometeam_short',hometeamName)

							if len(awayteamName) > 14 and " " in awayteamName:
								item.setProperty('awayteam_long',awayteamName)
							else:
								item.setProperty('awayteam_short',awayteamName)

							item.setProperty('home_team_logo',livegame.HomeTeamObj.strTeamBadge)
							item.setProperty('away_team_logo',livegame.AwayTeamObj.strTeamBadge)
							if livegame.HomeGoals and bool(int(livegame.HomeGoals)>0):
								item.setProperty('has_home_goals',os.path.join(addon_path,"resources","img","goal.png"))
							if livegame.AwayGoals and bool(int(livegame.AwayGoals)>0):
								item.setProperty('has_away_goals',os.path.join(addon_path,"resources","img","goal.png"))
							if livegame.HomeGoalDetails: item.setProperty('home_goal_details',livegame.HomeGoalDetails)
							if livegame.AwayGoalDetails: item.setProperty('away_goal_details',livegame.AwayGoalDetails)
							item.setProperty('league_and_round',livegame.League+' - ' + translate(32017) + ' '+livegame.Round)
							
							#red cards
							if livegame.HomeTeamRedCardDetails:
								home_redcards = livegame.HomeTeamRedCardDetails.split(";")
								for redcard in home_redcards:
									if not redcard: home_redcards.remove(redcard)
								if len(home_redcards) == 1: item.setProperty('home_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
								elif len(home_redcards) > 1:
									item.setProperty('home_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
									item.setProperty('home_redcard2',os.path.join(addon_path,"resources","img","redcard.png"))
							if livegame.AwayTeamRedCardDetails:
								away_redcards = livegame.AwayTeamRedCardDetails.split(";")
								for redcard in away_redcards:
									if not redcard: away_redcards.remove(redcard)
								if len(away_redcards) == 1: item.setProperty('away_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
								elif len(away_redcards) > 1:
									item.setProperty('away_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
									item.setProperty('away_redcard2',os.path.join(addon_path,"resources","img","redcard.png"))
							
							#Convert event time to user timezone
							if livegame.Time.lower() == "not started":
								try:
									db_time = pytz.timezone(str(pytz.timezone("Europe/London"))).localize(livegame.DateTime)
									my_location=pytz.timezone(pytz.all_timezones[int(my_timezone)])
									converted_time=db_time.astimezone(my_location)
									starttime=converted_time.strftime("%H:%M")
									item.setProperty('starttime',starttime)
								except: pass

							#set match progress
							matchpercent = "0"
							if "'" in livegame.Time.lower():
								try:
									matchpercent = str(int((float(livegame.Time.replace("'",""))/90)*100))
								except: pass
							else:
								if livegame.Time.lower() == "halftime":
									matchpercent = "50"
								elif livegame.Time.lower() == "postponed" or livegame.Time.lower() == "not started":
									matchpercent = "0"
								elif livegame.Time.lower() == "finished":
									matchpercent = "100" 
							item.setProperty("matchpercent",matchpercent)

							#check match status
							item.setProperty('minute',str(ssutils.translatematch(livegame.Time)))
							if livegame.Time.lower() == "finished": status = os.path.join(addon_path,"resources","img","redstatus.png")
							elif "'" in livegame.Time.lower(): status = os.path.join(addon_path,"resources","img","greenstatus.png")
							else: status = os.path.join(addon_path,"resources","img","yellowstatus.png")
							item.setProperty('status',status)
							items.append(item)
						
							self.livecopy.append(livegame)

		self.getControl(32500).reset()
		if items:
			xbmc.executebuiltin("ClearProperty(no-games,Home)")
			self.getControl(32500).addItems(items)
			self.setFocusId(32500)
		else:
			self.set_no_games()
		return
示例#4
0
	def setLivescores(self):
		items = []
		self.livecopy = []
		if self.livescoresdata:
			for livegame in self.livescoresdata:
				if removeNonAscii(livegame.League).strip().lower() not in str(self.ignored_leagues):

					#decide to add the match or not
					if (livegame.Time.lower() != "not started") and (livegame.Time.lower() != "finished") and (livegame.Time.lower() != "postponed"):
						add = True
					else:
						if livegame.Time.lower() == "not started" and hide_notstarted == "true":
							add = False
						elif livegame.Time.lower() == "postponed" and hide_notstarted == "true":
							add = False
						elif livegame.Time.lower() == "finished" and hide_finished == "true":
							add = False
						else:
							add = True
					if not livegame.HomeGoals.strip() and not livegame.AwayGoals.strip():
						add = False
					
					#Get only the team objects for the games that will be added (avoid unecessary requests)
					#Append to self.teamObjs	
					if add == True:
						id_teams = []
						if livegame.HomeTeam_Id:
							id_teams.append(livegame.HomeTeam_Id)
						else:
							id_teams.append(None)

						if livegame.AwayTeam_Id:
							id_teams.append(livegame.AwayTeam_Id)
						else:
							id_teams.append(None)
	
						index = 0 #To distinguish home (0) from away team (1)
						for id_team in id_teams:
							if id_team:
								update_team_data = True
								if self.cache_object.isCachedTeam(id_team):
									update_team_data = abs(self.t2 - self.cache_object.getCachedTeamTimeStamp(id_team)) > datetime.timedelta(hours=self.hoursList[self.interval])
			                    
								if update_team_data:
									try:
										teamobject = api.Lookups().Team(teamid=id_team)[0]
										self.cache_object.cacheTeam(teamid=id_team,team_obj=teamobject)
										xbmc.log(msg="[Match Center] Timedelta was reached for team %s new request to be made..." % (str(id_team)), level=xbmc.LOGDEBUG)
									except: 
										teamobject = None
								else:
									teamobject = self.cache_object.getcachedTeam(id_team)
									xbmc.log(msg="[Match Center] Used cached data for team %s..." % (str(id_team)), level=xbmc.LOGDEBUG)
			                    
								if index == 0:
									livegame.setHomeTeamObj(obj=teamobject)
								else:
									livegame.setAwayTeamObj(obj=teamobject)
							index += 1

						#if livegame.HomeTeamObj and livegame.AwayTeamObj:
						item = xbmcgui.ListItem(livegame.HomeTeam+livegame.AwayTeam)
						item.setProperty('result',str(livegame.HomeGoals)+"-"+str(livegame.AwayGoals))
							
						#Set team name label
						hometeamName = livegame.HomeTeam
						awayteamName = livegame.AwayTeam
						if show_alternative == "true":
							if livegame.HomeTeamObj:
								hometeamName = livegame.HomeTeamObj.AlternativeNameFirst
							if livegame.AwayTeamObj:
								awayteamName = livegame.AwayTeamObj.AlternativeNameFirst							

						#Choose between textbox (long names) or label (short names)
						if len(hometeamName) >= 14 and " " in hometeamName:
							item.setProperty('hometeam_long',hometeamName)
						else:
							item.setProperty('hometeam_short',hometeamName)

						if len(awayteamName) >= 14 and " " in awayteamName:
							item.setProperty('awayteam_long',awayteamName)
						else:
							item.setProperty('awayteam_short',awayteamName)

						#set team badge
						if livegame.HomeTeamObj and livegame.HomeTeamObj.strTeamBadge:
							item.setProperty('home_team_logo',livegame.HomeTeamObj.strTeamBadge)
						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: 
							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"))
						if livegame.AwayGoals and bool(int(livegame.AwayGoals)>0):
							item.setProperty('has_away_goals',os.path.join(addon_path,"resources","img","goal.png"))
						if livegame.HomeGoalDetails: item.setProperty('home_goal_details',livegame.HomeGoalDetails)
						if livegame.AwayGoalDetails: item.setProperty('away_goal_details',livegame.AwayGoalDetails)
						item.setProperty('league_and_round',livegame.League+' - ' + translate(32017) + ' '+livegame.Round)
							
						#red cards
						if livegame.HomeTeamRedCardDetails:
							home_redcards = livegame.HomeTeamRedCardDetails.split(";")
							for redcard in home_redcards:
								if not redcard: home_redcards.remove(redcard)
							if len(home_redcards) == 1: item.setProperty('home_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
							elif len(home_redcards) > 1:
								item.setProperty('home_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
								item.setProperty('home_redcard2',os.path.join(addon_path,"resources","img","redcard.png"))
						if livegame.AwayTeamRedCardDetails:
							away_redcards = livegame.AwayTeamRedCardDetails.split(";")
							for redcard in away_redcards:
								if not redcard: away_redcards.remove(redcard)
							if len(away_redcards) == 1: item.setProperty('away_redcard2',os.path.join(addon_path,"resources","img","redcard.png"))
							elif len(away_redcards) > 1:
								item.setProperty('away_redcard1',os.path.join(addon_path,"resources","img","redcard.png"))
								item.setProperty('away_redcard2',os.path.join(addon_path,"resources","img","redcard.png"))
							
						#Convert event time to user timezone
						if livegame.Time.lower() == "not started":
							try:
								db_time = pytz.timezone(str(pytz.timezone("Etc/UTC"))).localize(livegame.DateTime)
								my_location=pytz.timezone(pytz.all_timezones[int(my_timezone)])
								converted_time=db_time.astimezone(my_location)
								starttime=converted_time.strftime("%H:%M")
								item.setProperty('starttime',starttime)
							except Exception, e:
								xbmc.log(msg="[Match Center] Exception: %s" % (str(e)), level=xbmc.LOGDEBUG)

						#set match progress
						matchpercent = "0"
						if "'" in livegame.Time.lower():
							try:
								matchpercent = str(int((float(livegame.Time.replace("'",""))/90)*100))
							except: pass
						else:
							if livegame.Time.lower() == "halftime":
								matchpercent = "50"
							elif livegame.Time.lower() == "postponed" or livegame.Time.lower() == "not started":
								matchpercent = "0"
							elif livegame.Time.lower() == "finished":
								matchpercent = "100" 
						item.setProperty("matchpercent",matchpercent)

						#check match status
						item.setProperty('minute',str(ssutils.translatematch(livegame.Time)))
						if livegame.Time.lower() == "finished": status = os.path.join(addon_path,"resources","img","redstatus.png")
						elif "'" in livegame.Time.lower(): status = os.path.join(addon_path,"resources","img","greenstatus.png")
						else: status = os.path.join(addon_path,"resources","img","yellowstatus.png")
						item.setProperty('status',status)
						items.append(item)
						
						self.livecopy.append(livegame)