2012-07-26, 10:28
Edit: Figured out how to send the request but now I am getting a 401.
When I put the Same URL string in FireFox I get a result of "OK" So it seems to work fine there
Thoughts?
-------------------------------------------------------------------------------------------------------------------
Note: This seemed the best place to ask
I have writen a script to auto extract my TV shows (yes I know XBMC plays rars). So after getting that working I wanted to add to it and have it update the XBMC Library automatically, and then if there is a way confirm that XBMC received the request. However I need help with the powerShell syntax.
Here is what I have so far. I got the actual URL request string from a script I found while googling.
How do i send the request? I have been googling for an hour and can't find anything explaining this class fully.
Any help is much appreciated.
When I put the Same URL string in FireFox I get a result of "OK" So it seems to work fine there
Thoughts?
Code:
function updateXBMC([string]$showName){
$xbmcAddress = "http://media:[email protected]:8080"
$sourcePath = "smb://SERVER/TV Shows/TV Shows"
$command = "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,`"$sourcePath/$showName`"))"
$fullURL = "$xbmcAddress$command"
$fullURL = $($($fullURL.Replace(" ","%20")).Replace("(","%28")).Replace(")","%29")
Write-Host $fullURL
$reQUpdateLib = new-object net.webclient
#Start-Sleep -s 5
$reSUpdateLib = $reQUpdateLib.DownloadString($fullURL)
Write-Host "--------Result Start---------------"
Write-Host $reSUpdateLib
Write-Host "--------Result End-----------------"
$command = "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(uTorrent:%20Finished%20download,`"$($showName.Replace(" ","%20"))`"))"
$fullURL = "$xbmcAddress$command"
$fullURL = $fullURL.Replace(" ","%20")
Write-Host $fullURL
$reQNotify = new-object net.webclient
Write-Host "--------Result Start---------------"
$reSNotify = $reQNotify.DownloadString("$fullURL")
}
-------------------------------------------------------------------------------------------------------------------
Note: This seemed the best place to ask
I have writen a script to auto extract my TV shows (yes I know XBMC plays rars). So after getting that working I wanted to add to it and have it update the XBMC Library automatically, and then if there is a way confirm that XBMC received the request. However I need help with the powerShell syntax.
Here is what I have so far. I got the actual URL request string from a script I found while googling.
Code:
function updateXBMC ($showName,$showDirPath){
$xbmcAddress = "http://user:[email protected]:8080"
$command = "/xbmcCmds/xbmcHttp?ExecBuiltIn(UpdateLibrary(video," + $showDirPath + "/))"
WebRequest requestUpdateLib = WebRequest.Create($xbmcAddress $command)
#WebRequest requestNotify = WebRequest.Create($xbmcAddress "/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification(uTorrent:%20Finished%20download," + $showName+ "))")
}
How do i send the request? I have been googling for an hour and can't find anything explaining this class fully.
Any help is much appreciated.