def __init__(self, *args, **kwargs): self.window = None self.season_list = None self.season_items = [] self.clicked_season = -1 self.weeks_list = None self.weeks_items = [] self.clicked_week = -1 self.games_list = None self.games_items = [] self.clicked_game = -1 self.live_list = None self.live_items = [] self.selected_season = '' self.selected_week = '' self.main_selection = None self.player = None self.list_refill = False self.focusId = 100 self.seasons_and_weeks = gpr.get_seasons_and_weeks() self.player = xbmc.Player() self.thread = threading.Timer(1000, lambda: None) if overlay_scores: self.matchups = yahoo_tools.get_matchup_points(y3, token, league_key) self.d = '''[V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding Style: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.00,9:59:59.00,Default,,0,0,0,,{\\an 3}{\\fs10}''' xbmcgui.WindowXML.__init__(self, *args, **kwargs) self.action_previous_menu = (9, 10, 92, 216, 247, 257, 275, 61467, 61448)
def update_textboxes(self): matchups = yahoo_tools.get_matchup_points(y3, token, league_key) refresh_rate = int(addon.getSetting('refresh_rate')) points_idx = int(addon.getSetting('points_type')) points_type = ['points', 'projected_points'][points_idx] subtext = '' txt = ['', ''] max_len = max([max(len(format_name(m[0]['name'])), len(format_name(m[1]['name']))) for m in self.matchups]) for n, matchup in enumerate(matchups): for m, team in enumerate(matchup): old_matchup = self.matchups[n][m] colormu = self.get_score_color(old_matchup[points_type], team[points_type]) name = format_name(team['name']) points = format(team[points_type], '3.2f') if m == 0: txt[m] += '%s %s\n' % (name, points) subtext += '%s%s%s %s%s ' % ( white, name, colormu, ' ' * (6 - len(points)), points) else: txt[m] += '%s %s\n' % (points, name) subtext += '%s%s%s %s%s%s |\\N' % ( colormu, ' ' * (6 - len(points)), points, white, name, ' ' * (max_len - len(name))) self.left_textbox.setText(txt[0] + 'last updated') self.right_textbox.setText(txt[1] + str(time.ctime())) self.matchups = matchups with open(subtitle_filename, 'w') as f: f.write(self.d + subtext) self.player.setSubtitles(subtitle_filename) self.player.showSubtitles(True) self.thread = threading.Timer(refresh_rate, self.update_textboxes) self.thread.daemon = True self.thread.start()