# PictureFetcher.ps1
# Connects to the cameras and downloads the current picture

$storageDir = "\\Megabyte.home.zyrex.org\Vault\Vault\Upload\Webcam\Timelapse\"

$urlTunet = "http://172.17.50.221/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=snapshot&password=snapshot"
$urlGaardsplass = "http://172.17.50.220/ISAPI/Streaming/channels/101/picture"

$fileTunet = "$storageDir\Tunet_$(Get-Date -Format "yyyyMMdd_HH-mm-ss").jpg"
$fileGaardsplass = "$storageDir\Gaardsplass_$(Get-Date -Format "yyyyMMdd_HH-mm-ss").jpg"


$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($urlTunet,$fileTunet)

$webclient.Credentials = new-object System.Net.NetworkCredential('snapshot', 'Snapshot')
$webclient.DownloadFile($urlGaardsplass,$fileGaardsplass)