本文整理汇总了Python中orddict.OrdDict.name方法的典型用法代码示例。如果您正苦于以下问题:Python OrdDict.name方法的具体用法?Python OrdDict.name怎么用?Python OrdDict.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orddict.OrdDict
的用法示例。
在下文中一共展示了OrdDict.name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProcessVideoProfile
# 需要导入模块: from orddict import OrdDict [as 别名]
# 或者: from orddict.OrdDict import name [as 别名]
def ProcessVideoProfile(self):
class DisplayProfileGroups(MythTV.database.DBData):
pass
class DisplayProfiles(OrdDict):
def __new__(cls, *args, **kwargs):
inst = super(DisplayProfiles, cls).__new__(cls, *args, **kwargs)
inst.__dict__["_profilegroupid"] = None
inst.__dict__["_profileid"] = None
inst.__dict__["_db"] = None
return inst
def __init__(self, profilegroupid, profileid, db=None):
self._db = MythTV.database.DBCache(db=db)
self._profilegroupid = profilegroupid
self._profileid = profileid
with db as cursor:
cursor.execute(
"""SELECT value,data FROM displayprofiles
WHERE profilegroupid=%s
AND profileid=%s""",
(profilegroupid, profileid),
)
for k, v in cursor.fetchall():
self[k] = v
@classmethod
def fromProfileGroup(cls, profilegroupid, db=None):
db = MythTV.database.DBCache(db=db)
with db as cursor:
cursor.execute(
"""SELECT DISTINCT(profileid)
FROM displayprofiles
WHERE profilegroupid=%s""",
profilegroupid,
)
for profileid in cursor.fetchall():
yield cls(profilegroupid, profileid[0], db)
data = OrdDict()
data.name = _SETTINGS.DefaultVideoPlaybackProfile
data.profiles = []
profilegroupid = DisplayProfileGroups((data.name, _DB.gethostname()), _DB).profilegroupid
for profile in DisplayProfiles.fromProfileGroup(profilegroupid, _DB):
d = OrdDict()
d.decoder = profile.pref_decoder
d.deint_pri = profile.pref_deint0
d.deint_sec = profile.pref_deint1
d.renderer = profile.pref_videorenderer
d.filters = profile.pref_filters
data.profiles.append(d)
return {"playbackprofile": data}