def __pts_available(self): if getPlayPositionPts(self.session) is None: self.__timer.start(500, True) else: if self.__resume_time_sec is not None: duration_sec = getDurationInSeconds(self.session) if (self.__resume_time_sec > 0 and duration_sec and duration_sec > 0 and self.__resume_time_sec < duration_sec): self.doSeek(self.__resume_time_sec * 90000) self.__resume_time_sec = None RemovePopup(self.RESUME_POPUP_ID) if self.__subtitles_url: self.loadSubs(toString(self.__subtitles_url))
def poll(self): # Reloading, reschedule if self.reloading: print("[SimpleRSS] timer triggered while reloading, rescheduling") self.poll_timer.start(10000, 1) # End of List elif len(self.feeds) <= self.current_feed: # New Items if self.newItemFeed.history: print("[SimpleRSS] got new items, calling back") self.doCallback() # Inform User update_notification_value = config.plugins.simpleRSS.update_notification.value if update_notification_value == "preview": from RSSScreens import RSSFeedView from Tools.Notifications import AddNotificationWithID, RemovePopup RemovePopup(NOTIFICATIONID) AddNotificationWithID(NOTIFICATIONID, RSSFeedView, self.newItemFeed, newItems=True) elif update_notification_value == "notification": AddPopup( _("Received %d new news item(s).") % (len(self.newItemFeed.history)), MessageBox.TYPE_INFO, 5, NOTIFICATIONID) elif update_notification_value == "ticker": from RSSTickerView import tickerView if not tickerView: print( "[SimpleRSS] missing ticker instance, something with my code is wrong :-/" ) else: tickerView.display(self.newItemFeed) # No new Items else: print("[SimpleRSS] no new items") self.current_feed = 0 self.poll_timer.startLongTimer( config.plugins.simpleRSS.interval.value * 60) # It's updating-time else: # Assume we're cleaning history if current feed is 0 clearHistory = self.current_feed == 0 if config.plugins.simpleRSS.update_notification.value != "none": from Tools import Notifications if hasattr(Notifications, 'notificationQueue'): notifications = Notifications.notificationQueue.queue current_notifications = Notifications.notificationQueue.current handler = lambda note: (note.fnc, note.screen, note.args, note.kwargs, note.id) handler_current = lambda note: (note[0].id, ) else: notifications = Notifications.notifications current_notifications = Notifications.current_notifications handler_current = handler = lambda note: note for x in current_notifications: if handler_current(x)[0] == NOTIFICATIONID: print( "[SimpleRSS] timer triggered while preview on screen, rescheduling" ) self.poll_timer.start(10000, 1) return if clearHistory: for x in notifications: if handler(x)[4] == NOTIFICATIONID: print( "[SimpleRSS] wont wipe history because it was never read" ) clearHistory = False break if clearHistory: del self.newItemFeed.history[:] # Feed supposed to autoupdate feed = self.feeds[self.current_feed] if feed.autoupdate: getPage(feed.uri).addCallback(self._gotPage).addErrback( self.error) # Go to next feed else: print("[SimpleRSS] passing feed") self.next_feed()
def __on_close(self): self.__timer.stop() del self.__timer_conn del self.__timer RemovePopup(self.RESUME_POPUP_ID) self.session.deleteDialog(self.status_dialog)
def AddPopupGPU(text, type, timeout, id = None, domain = None, screen=MessageBoxGPU, additionalActionMap=None): #print "=== AddPopupGPU" if id is not None: RemovePopup(id) print "AddPopup, id =", id, "domain =", domain AddNotification(None, screen, id, text = text, type = type, timeout = timeout, close_on_any_key = True)