Exemplo n.º 1
0
def raiseError(message=False, log=False, error=False):
    mc.HideDialogWait()
    if (log and error):
        mc.LogError(((('@mlb.tv (' + log) + ') ') + str(error)))
    if message:
        response = message
    else:
        response = 'An error has occurred. Details have been saved in your log. Please notify Boxee support.'
    mc.ShowDialogOk('MLB.TV', response)
    return False
Exemplo n.º 2
0
 def log(self, message, e):
     return mc.LogError("BoxeeJobManager: %s! %s" % (message, str(e)))
Exemplo n.º 3
0
 def error(self, message):
     mc.LogError("BoxeeJob %s: %s" % (self.name, str(message)))
Exemplo n.º 4
0
 def error(self, message):
     mc.LogError("BoxeeJobManager: %s" % (str(message)))
Exemplo n.º 5
0
def logError(msg):
	mc.LogError("Plexee: "+msg)
Exemplo n.º 6
0
def error(func, msg):
    mc.LogError(((('@mlb.tv (' + func) + ') ') + str(msg)))
Exemplo n.º 7
0
def loadSport(sport_id):
    mc.LogDebug("Loading sport %s" % sport_id)
    mc.ShowDialogWait()

    label = mc.GetActiveWindow().GetLabel(9010)
    sport = None
    for SPORT in SPORTS:
        if SPORT['id'] == sport_id:
            sport = SPORT
            break
    else:
        mc.LogError("Sport %s not found." % sport_id)
        mc.ShowDialogOk("Error", "Sport %s not found." % sport_id)
        mc.CloseWindow()
    label.SetLabel(sport['title'])

    gamesList = mc.GetActiveWindow().GetList(9000)
    gamesItems = mc.ListItems()

    content = feedparser.parse(urllib.urlopen(FEED % sport_id))
    for item in content['entries']:
        title = str(item.title)
        match = sport['regex_title'].match(title)
        if match:
            day_date = date(int(match.group('year')),
                            MONTHS.index(match.group('month').lower()),
                            int(match.group('day')))
            if day_date < date.today():
                continue

            for game in sport['regex_game'].finditer(str(item.content)):
                game_time = time.strptime(
                    '%s %s EST' % (day_date, game.group('est_time')),
                    '%Y-%m-%d %I:%M %p %Z')
                #Skip games that occured more than 5 hours ago
                if time.localtime(time.mktime(game_time) +
                                  5 * 60 * 60) < time.time():
                    continue

                name = '%s @ %s' % (game.group('team_away').strip(),
                                    game.group('team_home').strip())

                streams = []
                for stream in sport['regex_stream'].finditer(
                        game.group('streams')):
                    mc.LogDebug(
                        'MYP2P::: "%s" - Stream "%s" (%s)' %
                        (name, stream.group('name'), stream.group('url')))
                    streams.append(stream.groupdict())
                stream_string = '\n'.join([
                    '%s\t%s' % (stream['name'], stream['url'])
                    for stream in streams
                ])

                gameItem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN)
                gameItem.SetLabel(name)
                gameItem.SetProperty('streams', stream_string)
                gamesItems.append(gameItem)

    gamesList.SetItems(gamesItems)
    mc.HideDialogWait()