def trackView(self, window=False): mc.LogDebug( "%%%%%%%%%%%%%%%%%%% Tracker: Tracking view. %%%%%%%%%%%%%%%%%%%") if not window: window = "14000" mc.LogDebug( "%%%%%%%%%%%%%%%%%%% Tracker: Requesting tracker image path. %%%%%%%%%%%%%%%%%%%%%%%%%" ) params = {'application': self.application, 'window': window} if self.uacode: params['uacode'] = self.uacode if self.debug: params['debug'] = self.debug tracker = self.request(self.path + "?" + urllib.urlencode(params)) if self.debug: mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: Path is " + str(tracker) + " %%%%%%%%%%%%%%%%%%%%%%%%%") tracker = self.request(str(tracker)) mc.LogDebug("%%%%%%%%%%%%%%%%%%% GA Debug: " + str(tracker) + " %%%%%%%%%%%%%%%%%%%%%%%%%") elif tracker: mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: Path is " + str(tracker) + " %%%%%%%%%%%%%%%%%%%%%%%%%") return self.request(str(tracker)) else: mc.LogDebug( "%%%%%%%%%%%%%%%%%%% Tracker: tracking request failed. %%%%%%%%%%%%%%%%%%%" ) return False
def trackEvent(self, event, action, label, value = False): mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: Tracking event. %%%%%%%%%%%%%%%%%%%") params = { 'application': self.application, 'event': event, 'action': action, 'label': label } if value: eventPath = eventPath + "&value=" + value if self.uacode: params['uacode'] = self.uacode if self.debug: params['debug'] = self.debug eventPath = self.path + "?" + urllib.urlencode(params) mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: Requesting tracker image path. %%%%%%%%%%%%%%%%%%%%%%%%%") tracker = self.request(eventPath) if self.debug: mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: Path is " + str(tracker) + " %%%%%%%%%%%%%%%%%%%%%%%%%") tracker = self.request(str(tracker)) mc.LogDebug("%%%%%%%%%%%%%%%%%%% GA Debug: " + str(tracker) + " %%%%%%%%%%%%%%%%%%%%%%%%%") elif tracker: mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: Path is " + str(tracker) + " %%%%%%%%%%%%%%%%%%%%%%%%%") return self.request(str(tracker)) else: mc.LogDebug("%%%%%%%%%%%%%%%%%%% Tracker: tracking request failed. %%%%%%%%%%%%%%%%%%%") return False
import mc import time mc.LogDebug("***** TOZ.TCTV *****") mc.LogDebug("app start") mc.LogDebug("***** TOZ.TCTV *****") mc.ActivateWindow(14000) mc.LogDebug("***** TOZ.TCTV *****") mc.LogDebug("splash start") mc.LogDebug("***** TOZ.TCTV *****") time.sleep(1.5) config = mc.GetApp().GetLocalConfig() config.ResetAll() config.SetValue("runtime", 'first') #mc.LogDebug("***** TOZ.TCTV *****") #mc.LogDebug("No Close Window") #mc.LogDebug("***** TOZ.TCTV *****") #mc.CloseWindow() #mc.LogDebug("***** TOZ.TCTV *****") #mc.LogDebug("Window Closed") #mc.LogDebug("***** TOZ.TCTV *****") mc.ActivateWindow(14001) mc.LogDebug("***** TOZ.TCTV *****") mc.LogDebug("main launched") mc.LogDebug("***** TOZ.TCTV *****")
def log(self, message): mc.LogDebug("BoxeeJob %s: %s" % (self.name, str(message)))
def log(self, message): mc.LogDebug("BoxeeJobManager: %s" % (str(message)))
def logDebug(msg): _debug = mc.GetApp().GetLocalConfig().GetValue("debug") if _debug: print "Plexee: "+msg else: mc.LogDebug("Plexee: "+msg)
def debug(func, msg): mc.LogDebug(((('@mlb.tv (' + func) + ') ') + str(msg)))
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()