本文整理汇总了Python中orddict.OrdDict.rectotal方法的典型用法代码示例。如果您正苦于以下问题:Python OrdDict.rectotal方法的具体用法?Python OrdDict.rectotal怎么用?Python OrdDict.rectotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orddict.OrdDict
的用法示例。
在下文中一共展示了OrdDict.rectotal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProcessStorage
# 需要导入模块: from orddict import OrdDict [as 别名]
# 或者: from orddict.OrdDict import rectotal [as 别名]
def ProcessStorage(self):
def processdirs(paths):
total = 0
free = 0
for path in paths:
stat = os.statvfs(path)
bsize = stat[statvfs.F_FRSIZE]
total += stat[statvfs.F_BLOCKS]*bsize
free += stat[statvfs.F_BFREE]*bsize
return (total, free)
data = OrdDict()
data.rectotal = 0
data.recfree = 0
data.videototal = 0
data.videofree = 0
if not self.isBackend():
return data
sgnames = [rec.storagegroup for rec in MythTV.Recorded.getAllEntries()]
sgnames += [rec.storagegroup for rec in MythTV.Record.getAllEntries()]
sgnames = list(set(sgnames))
sgs = []
for host in set([_DB.gethostname(), _BE.hostname]):
for sgname in sgnames:
for sg in _DB.getStorageGroup(sgname, host):
if sg.local:
sgs.append(sg.dirname)
data.rectotal, data.recfree = processdirs(sgs)
sgs = [sg.dirname for sg in _DB.getStorageGroup('Videos', _DB.gethostname()) if sg.local]
data.videototal, data.videofree = processdirs(sgs)
return {'storage': data}