本文整理汇总了Python中orddict.OrdDict.size方法的典型用法代码示例。如果您正苦于以下问题:Python OrdDict.size方法的具体用法?Python OrdDict.size怎么用?Python OrdDict.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orddict.OrdDict
的用法示例。
在下文中一共展示了OrdDict.size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProcessPrograms
# 需要导入模块: from orddict import OrdDict [as 别名]
# 或者: from orddict.OrdDict import size [as 别名]
def ProcessPrograms(self):
rdata = OrdDict()
edata = OrdDict()
ldata = OrdDict()
udata = OrdDict()
data = {'scheduled': rdata,
'expireable': edata,
'livetv': ldata,
'upcoming': udata}
progs = list(MythTV.Recorded.getAllEntries())
upcoming = list(_BE.getUpcomingRecordings())
livetv = [prog for prog in progs if prog.recgroup == 'LiveTV']
recs = [prog for prog in progs if prog.recgroup != 'LiveTV']
expireable = [prog for prog in recs if prog.autoexpire]
times = []
for dataset in (recs, expireable, livetv, upcoming):
if len(dataset):
try:
deltas = [rec.endtime-rec.starttime for rec in dataset]
except:
deltas = [rec.recendts-rec.recstartts for rec in dataset]
secs = self.td_to_secs(deltas.pop())
for delta in deltas:
secs += self.td_to_secs(delta)
times.append(secs)
else:
times.append(0)
rdata.count = len(recs)
rdata.size = sum([rec.filesize for rec in recs])
rdata.time = times[0]
edata.count = len(expireable)
edata.size = sum([rec.filesize for rec in expireable])
edata.time = times[1]
ldata.count = len(livetv)
ldata.size = sum([rec.filesize for rec in livetv])
ldata.time = times[2]
udata.count = len(upcoming)
udata.time = times[3]
return {'recordings': data}