本文整理汇总了Python中orddict.OrdDict.sr_override方法的典型用法代码示例。如果您正苦于以下问题:Python OrdDict.sr_override方法的具体用法?Python OrdDict.sr_override怎么用?Python OrdDict.sr_override使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orddict.OrdDict
的用法示例。
在下文中一共展示了OrdDict.sr_override方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProcessAudio
# 需要导入模块: from orddict import OrdDict [as 别名]
# 或者: from orddict.OrdDict import sr_override [as 别名]
def ProcessAudio(self):
def _bool(val):
if val is None:
return False
return bool(int(val))
def _read_file(filename):
firstline=[]
try:
with open(filename,'r') as f:
line = f.readline()
firstline = line.split()
except:
pass
return firstline
def _oss_alsa():
snd_type = "unknown"
version = "unknown"
alsasnd = "/proc/asound/version"
osssnd = "/dev/sndstat"
if os.path.exists(alsasnd):
snd_type = "ALSA"
version = _read_file(alsasnd)[-1].rstrip(".")
elif os.path.exists(osssnd):
version = _read_file(osssnd)[1]
snd_type = "OSS"
return snd_type , version
def _process_search(processname):
foundit = False
for line in os.popen("ps xa"):
fields = line.split()
pid = fields[0]
process = fields[4].split("/")
if processname in process :
foundit = True
break
return foundit
def _jack():
if _process_search("jackd") or _process_search("jackdbus"):
foundit = 1
else:
foundit = 0
return foundit
def _pulse():
if _process_search("pulseaudio"):
foundit = 1
else:
foundit = 0
return foundit
data = OrdDict()
data.device = _SETTINGS.AudioOutputDevice
data.passthrudevice = _SETTINGS.PassThruOutputDevice
data.passthruoverride = _bool(_SETTINGS.PassThruDeviceOverride)
data.stereopcm = _bool(_SETTINGS.StereoPCM)
data.sr_override = _bool(_SETTINGS.Audio48kOverride)
data.maxchannels = _SETTINGS.MaxChannels
data.defaultupmix = _bool(_SETTINGS.AudioDefaultUpmix)
data.upmixtype = _SETTINGS.AudioUpmixType
p = []
for k,v in (('AC3PassThru', 'ac3'), ('DTSPassThru', 'dts'),
('HBRPassthru', 'hbr'), ('EAC3PassThru', 'eac3'),
('TrueHDPassThru', 'truehd'), ('DTSHDPassThru', 'dtshd')):
if _bool(_SETTINGS[k]):
p.append(v)
data.passthru = p
data.volcontrol = _bool(_SETTINGS.MythControlsVolume)
data.mixerdevice = _SETTINGS.MixerDevice
data.mixercontrol = _SETTINGS.MixerControl
data.jack = _jack()
data.pulse = _pulse()
data.audio_sys, data.audio_sys_version = _oss_alsa()
return {'audio': data}