Easily switch Audio Output Device
(2014-06-03, 15:05)onlyyou Wrote: stmatrix, any chance you make that wonderfull python script works on Gotham ?

(2014-01-04, 04:10)stmatrix Wrote: any news?

here is what I've been using on Eden for past two years (HTPC + 2 tv's. 1-optical, 2-hdmi):

X:\Program Files\XBMC\system\python\Lib\audioswitch.py
import os, xbmc
current_audio_mode = xbmc.executehttpapi( "GetGUISetting(3;audiooutput.audiodevice)" ).replace("<li>","")
print current_audio_mode
if current_audio_mode == "wasapi:Realtek Digital Output(Optical) (Realtek High Definition Audio)":  # set values for switching to HDMI
audio_mode = "wasapi:LG TV-0 (2- NVIDIA High Definition Audio)"
# audio_device = "text.from.<audiodevice>.tag.while.in.HDMI.mode"
# audio_output = "HDMI"  # Optional, if notification used
else:  # set values for switching to optical
audio_mode = "wasapi:Realtek Digital Output(Optical) (Realtek High Definition Audio)"
# audio_device = "text.from.<audiodevice>.tag.while.in.Analog.mode"
# audio_output = "ANALOG"  #Optional, if notification used
# Change audio settings and display notification of new mode:
xbmc.executehttpapi( "SetGUISetting(3;audiooutput.audiodevice;%s)" % audio_mode )
# xbmc.executehttpapi( "SetGUISetting(3;audiooutput.audiodevice;%s)" % audio_device )
xbmc.executebuiltin( "Notification(Audio output changed to:, %s, 2000)" %audio_mode )  # Optional notification

and add to keyboard keymap:
<m mod="ctrl,shift">XBMC.RunScript(c:\Users\Matrix\AppData\Roaming\XBMC\system\python\Lib\audioswitch.py)</m>

then I used DVD-Menu (ctrl+shift+m) button to switch output audio device on my MCE remote....
but now i need to adapt this for Gotham... any thoughts?

This won't work with Gotham the xbmc.executehttpapi call has been deprecated in favour of routines from the JSON-API , I think that's what you call it. But what the equivalent routine is or if it even exists is anybodies guess !

Messages In This Thread
RE: Easily switch Audio Output Device - by jimmyg - 2014-06-25, 00:32

Logout Mark Read Team Forum Stats Members Help
Easily switch Audio Output Device0
This forum uses Lukasz Tkacz MyBB addons.