def AddFavoriteTeamShortcut(self):
        """
    A shortcut to watching your favorite team's video stream
    """
        team = TeamList.favoriteTeam()
        game = None
        stream = None

        if team:
            kwargs = {
                "title":
                C["FAVORITE_MARKER"] + "Watch the " + team.name + " Game",
                "thumb": R('logo-' + team.abbrev + '.png')
            }
            try:
                game = (game for game in getDailyGames()
                        if game.isFavorite()).next()
                if not game:
                    self.AddMessage(
                        "It looks like the " + team.name +
                        " aren't playing today.", **kwargs)
                else:
                    stream = game.streams.getBest()
                    kwargs = {
                        "title":
                        C["FAVORITE_MARKER"] +
                        ("Listen to" if stream.kind == "audio" else "Watch") +
                        " the " + team.name + " Game",
                        "thumb":
                        R('logo-' + team.abbrev + '.png')
                    }
                    if stream.pending:
                        if game.isFinal():
                            self.AddMessage(
                                "The game has ended, but the archived stream isn't available yet.",
                                header="Stream Not Available",
                                **kwargs)
                        else:
                            self.AddMessage("The " + team.name +
                                            " stream isn't available yet.",
                                            header="Stream Not Available",
                                            **kwargs)
                    else:
                        video_url = C["URL"]["PLAYER"] + "?" + urllib.urlencode(
                            {
                                'calendar_event_id': game.event_id,
                                'content_id': stream.id if stream.id else "",
                                'source': 'MLB'
                            })
                        self.Append(WebVideoItem(video_url, **kwargs))
                return
            except:
                self.AddMessage("Try looking in the \"Today's Games\" menu.",
                                header="Error Loading Stream",
                                **kwargs)
 def __init__(self, sender, submenu=None):
   """
   List teams, displaying the 'submenu' Menu when selected.
   """
   ABCMenu.__init__(self, title2=sender.itemTitle)
   
   favoriteteam = TeamList.favoriteTeam()
   if favoriteteam:
     self.AddMenu(submenu, C["FAVORITE_MARKER"] + favoriteteam.fullName(), dict(thumb=R('logo-' + favoriteteam.abbrev + '.png')), teamId=favoriteteam.id)
   
   for team in TeamList.teams:
     if not favoriteteam or favoriteteam != team:
       self.AddMenu(submenu, team.fullName(), dict(thumb=R('logo-' + team.abbrev + '.png')), teamId=team.id)
    def __init__(self, sender, submenu=None):
        """
    List teams, displaying the 'submenu' Menu when selected.
    """
        ABCMenu.__init__(self, title2=sender.itemTitle)

        favoriteteam = TeamList.favoriteTeam()
        if favoriteteam:
            self.AddMenu(submenu,
                         C["FAVORITE_MARKER"] + favoriteteam.fullName(),
                         dict(thumb=R('logo-' + favoriteteam.abbrev + '.png')),
                         teamId=favoriteteam.id)

        for team in TeamList.teams:
            if not favoriteteam or favoriteteam != team:
                self.AddMenu(submenu,
                             team.fullName(),
                             dict(thumb=R('logo-' + team.abbrev + '.png')),
                             teamId=team.id)
 def AddFavoriteTeamShortcut(self):
   """
   A shortcut to watching your favorite team's video stream
   """
   team = TeamList.favoriteTeam()
   game = None
   stream = None
   
   if team:
     kwargs = {
       "title": C["FAVORITE_MARKER"] + "Watch the " + team.name + " Game",
       "thumb": R('logo-' + team.abbrev + '.png')
     }      
     try:
       game = (game for game in getDailyGames() if game.isFavorite()).next()
       if not game:
         self.AddMessage("It looks like the " + team.name + " aren't playing today.", **kwargs)
       else:
         stream = game.streams.getBest()
         kwargs = {
           "title": C["FAVORITE_MARKER"] + ("Listen to" if stream.kind == "audio" else "Watch") + " the " + team.name + " Game",
           "thumb": R('logo-' + team.abbrev + '.png')
         }
         if stream.pending:
           if game.isFinal():
             self.AddMessage("The game has ended, but the archived stream isn't available yet.", header="Stream Not Available", **kwargs)
           else:
             self.AddMessage("The " + team.name + " stream isn't available yet.", header="Stream Not Available", **kwargs)
         else:
           video_url = C["URL"]["PLAYER"] + "?" + urllib.urlencode({
             'calendar_event_id': game.event_id,
             'content_id': stream.id if stream.id else "",
             'source': 'MLB'
           })
           self.Append(WebVideoItem(video_url, **kwargs))
       return
     except:
       self.AddMessage("Try looking in the \"Today's Games\" menu.", header="Error Loading Stream", **kwargs)