Tuesday, November 10, 2009

Automatic XBMC library update

Since I have my computer set up to automatically download TV shows I wanted my XBMC library to be automatically updated at all time. The "Update on startup" option was insufficient in my case since I rarely restart my computer. The media center is running on Windows XP which meant Python was not an option (since it can't fully interact with XBMC under Windows). So I created a small VB application that uses the XBMC HTTP API to update the library:
Call UpdateXBMCLibrary()

Sub UpdateXBMCLibrary()
WScript.Timeout = 120
Dim objRequest

Set objRequest = CreateObject("Msxml2.ServerXMLHTTP")

URL = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"

objRequest.open "GET", URL , false, "username", "password"

Set objRequest = Nothing
End Sub

I set up the web interface so that it runs on port 8080 with my desired username and password, used the Msxml2.ServerXMLHTTP object to make the HTTP request and voilĂ ! It works.

I added a scheduled task in order to make it update frequently. I guess you could modify the application so that it recognizes changes amongst the files but one update an hour works fine for me.

No comments:

Post a Comment