def listMissed(self, cItem, nextCategory): printDBG("KijkNL.listMissed") dt = cItem.get('f_date', None) ITEMS_PER_PAGE = 15 if dt == None: dt = datetime.date.today() else: try: dt = datetime.datetime.strptime(dt, '%Y-%m-%d').date() except Exception: printExc() return dtIt = dt for m in range(ITEMS_PER_PAGE): url = self.tmpUrl + 'v1/default/sections/missed-all-' + dtIt.strftime( "%Y%m%d") params = { 'good_for_fav': False, 'category': nextCategory, 'title': dtIt.strftime("%d-%m-%Y"), 'url': url } self.addDir(params) dtIt = PrevDay(dtIt) params = dict(cItem) params.update({ 'good_for_fav': False, 'title': _('Next page'), 'f_date': dtIt.strftime('%Y-%m-%d') }) self.addDir(params)
def listDays(self, cItem, nextCategory): printDBG("PlayRTSIW.listDays [%s]" % cItem) type = cItem['f_type'] channelId = cItem.get('f_channel_id', '') if 'f_date' not in cItem: dt = datetime.now() else: dt = datetime.strptime(cItem['f_date'], '%d-%m-%Y').date() baseUrl = self.getFullUrl('/play/v2/{0}/programDay/%s/{1}'.format( type, channelId)) for item in range(31): title = dt.strftime('%d-%m-%Y') url = baseUrl % title params = dict(cItem) params.update({ 'good_for_fav': False, 'category': nextCategory, 'title': title, 'url': url }) self.addDir(params) dt = PrevDay(dt) params = dict(cItem) params.update({ 'good_for_fav': False, 'title': _('Older'), 'f_date': dt.strftime('%d-%m-%Y') }) self.addDir(params)
def listDays(self, cItem, nextCategory): printDBG("EuroSportPlayer.listDays [%s]" % cItem) NOW = datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0, tzinfo=None) def _dataLabel(d): weekday = self.ABBREVIATED_DAYS_NAME_TAB[d.weekday()] return '%s %s' % (d.day, self.serverApiData['i18n_dictionary'].get(weekday, weekday)) itemsList = [] #NextDay, PrevDay day = NOW for idx in range(7): day = PrevDay(day) itemsList.append(day) itemsList.reverse() itemsList.append(NOW) day = NOW for idx in range(7): day = NextDay(day) itemsList.append(day) for item in itemsList: title = _dataLabel(item) sData = item eData = item.replace(hour=23, minute=59, second=59, microsecond=999999, tzinfo=None) if item == NOW: title = 'Today' title = self.serverApiData['i18n_dictionary'].get(title, title) params = dict(cItem) params.update({'good_for_fav':False, 'category':nextCategory, 'title':title, 'f_sdate':sData, 'f_edate':eData}) self.addDir(params)
def listDays(self, cItem, nextCategory): printDBG("WPolscePL.listDays [%s]" % cItem) NOW = datetime.now() itemsList = [] #NextDay, PrevDay day = NOW for idx in range(7): day = PrevDay(day) itemsList.append(day) itemsList.reverse() itemsList.append(NOW) itemsList.append(NextDay(NOW)) for item in itemsList: date = item.strftime('%Y-%m-%d') if item == NOW: title = 'Dzisiaj' elif item > NOW: title = 'Jutro' else: title = date params = dict(cItem) params.update({ 'good_for_fav': False, 'category': nextCategory, 'title': title, 'f_date': date }) self.addDir(params)
def listChannelItems(self, cItem, nextCategory): printDBG("MediasetPlay.listChannelItems") sts, data = self.getPage(cItem['url']) if not sts: return self.setMainUrl(self.cm.meta['url']) channelId = ph.search( data, '''/diretta/[^'^"]+?_c([^'^"]+?)['"][^>]*?>\s*?diretta\s*?<''', flags=ph.I)[0] self.listCatalog(cItem, 'list_catalog_items', 'video_mixed', data) ABBREVIATED_DAYS_NAME_TAB = [ 'LUN', 'MAR', 'MER', 'GIO', 'VEN', 'SAB', 'DOM' ] subItems = [] today = datetime.datetime.utcnow() r = self.dateRange(today) start = r[0] + self.OFFSET end = r[1] + self.OFFSET for i in range(8): s = int(time.mktime(start.timetuple()) * 1000) e = int(time.mktime(end.timetuple()) * 1000) title = 'Oggi' if i == 0 else ABBREVIATED_DAYS_NAME_TAB[ start.weekday()] + ' ' + str(start.day).zfill(2) url = self.API_BASE_URL + 'alive/allListingFeedFilter/v1.0?byListingTime=%s~%s&byVod=true&byCallSign=%s' % ( s, e, channelId) subItems.append( MergeDicts( cItem, { 'good_for_fav': False, 'category': nextCategory, 'title': title, 'url': url })) start = PrevDay(start) end = PrevDay(end) self.addDir( MergeDicts( cItem, { 'category': 'sub_items', 'title': 'Ultima settimana', 'sub_items': subItems, }))
def listSeriesPremiere(self, cItem, nextCategory): printDBG("KinomanCO.listSeriesPremiere [%s]" % cItem) dt = cItem.get('f_date', None) ITEMS_PER_PAGE = 3 if dt == None: dt = PrevDay(datetime.date.today()) spin = 1 nextPage = False else: try: dt = datetime.datetime.strptime(dt, '%Y-%m-%d').date() spin = cItem['f_direction'] nextPage = True except Exception: printExc() return dtIt = dt for m in range(ITEMS_PER_PAGE): premiere = [] params = dict(cItem) params.update({'good_for_fav':False, 'category':nextCategory, 'title':dtIt.strftime("%d-%m-%Y"), 'f_premiere':dtIt.strftime("%Y-%m-%d")}) self.addDir(params) dtIt = NextDay(dtIt) if spin == 1 else PrevDay(dtIt) if spin == -1: self.currList.reverse() if nextPage: if spin == -1: title = _('Older') else: title = _('Newer') params = dict(cItem) params.update({'good_for_fav':False, 'title':title, 'f_date': dtIt.strftime('%Y-%m-%d')}) self.addDir(params) else: dt = PrevDay(dt) params = dict(cItem) params.update({'good_for_fav':False, 'title':_('Older'), 'f_direction':-1, 'f_date': dt.strftime('%Y-%m-%d')}) self.addDir(params) params = dict(cItem) params.update({'good_for_fav':False, 'title':_('Newer'), 'f_direction':1, 'f_date': dtIt.strftime('%Y-%m-%d')}) self.addDir(params)