Win Starting Airfoil out of XBMC
#1
Hello guys,
i hope this thread went to the right section in the forum.

I use XBMC in my living room with a windows 7 machine.
Now i wanted to listen to music in other rooms in my appartment so i came across the Apple AirPlay standard. And bought some airplay speakers.
After finding out that xbmc does not support streaming to AirPlay i came across the program Airfoil for windows by rogueamoeba ($25 and totally worth it).
It works fine with XBMC but the downside is, that you are only able to get audio on side, by meaning the TV or the airplay speakers.
So you have to start Airfoil everytime you want to listen to music on the airplay speakers. Starting the programm while XBMC running requires user action in the Airfoil program,
since it requires to restart the program from which it should stream.

So my idea was to write down 2 little batch scripts. One for enabling streaming to the programm and one for deactivating streaming to get the sound back to the TV.
So i installed airfoil and put the windows version of wget to the main directory of XBMC in order to shutdown xbmc with the json api. Which does not work properly(xbmc starts hanging & and is not responding).
Thats why i have to use the taskkill command to make sure that XBMC is not running.

I am asking for help in order to clean up the batch process. I think it's important that xbmc gets shutdown properly (in order to prevent corruption of the db).
To start the batch skripts i use two widgets in the aeon nox skin. ( xbmc.system.exec(C:\path\to\batch\batch.bat )

if you use the portable mode of xbmc creat a symbolic link in Appdata\roaming
i.e.:
mklink /H /J XBMC C:\XBMC\portable_data

I hope anyone can use scripts for a similar build and maybe extend them or clean them up.

Regards,
dirkie

Here are the two scripts:

Activate airplay streaming:
Code:
@echo off
rem make sure airfoil is not running
taskkill /F /IM Airfoil.exe
rem This is the install directory of my xbmc.
cd "C:\xbmc\"
rem This is the wget command in order to shutdown xbmc with jsonrpc. which does not work properly.
wget -q -O - "http://localhost/jsonrpc?request={%%20%%22jsonrpc%%22:%%20%%222.0%%22,%%20%%22method%%22:%%20%%22Application.Quit%%22,%%20%%22id%%22:%%200%%20}"
timeout /T 5
rem kill xbmc since json shutdown does not work...
taskkill /F /IM XBMC.exe
rem start airfoil make sure that xbmc is marked as default in airfoil. If it's default then airfoil will start xbmc
cd "C:\path\to\Airfoil\"
start Airfoil.exe
timeout /T 2
exit

Disable airplay streaming:
Code:
@echo off
rem This is the install directory of my xbmc.
cd "C:\xbmc\"  
rem This is the wget command in order to shutdown xbmc with jsonrpc. which does not work properly.
wget -q -O - "http://localhost/jsonrpc?request={%%20%%22jsonrpc%%22:%%20%%222.0%%22,%%20%%22method%%22:%%20%%22Application.Quit%%22,%%20%%22id%%22:%%200%%20}"
rem Wait a few seconds.
timeout /T 15
rem kill Airfoil.exe
taskkill /F /IM Airfoil.exe
rem kill xbmc since json shutdown does not work...
taskkill /F /IM XBMC.exe
rem Wait a few seconds.
timeout /T 3
rem restart xbmc
cd "C:\xbmc\"  
start XBMC.exe
exit
Reply

Logout Mark Read Team Forum Stats Members Help
Starting Airfoil out of XBMC0