-lahna Posted March 16, 2013 Posted March 16, 2013 Please help me. I have made a VBS script that moves old record files to NAS server. Now I need a help how to make a script to refresh recording database. Quote
nuts Posted March 16, 2013 Posted March 16, 2013 (edited) I posted a script (sourcecode included) that can run prozesstasks (ie. refresh recording database) here: http://www.DVBViewer.tv/forum/topic/51926-processtasksex/ You can use run it from your vbs skript or translate the functions directly to vbs: Func _Sendrequest($stask) ;bsp: http://192.168.1.100/tasks.html?task=CI_Reset&aktion=tasks ; http://192.168.1.100/tasks.html?task=CleanupRefreshDB&aktion=tasks Local $user = IniRead($konfig_ini, "RecordingService", "User", "admin") Local $pass = IniRead($konfig_ini, "RecordingService", "Password", "") Local $IP = IniRead($konfig_ini, "RecordingService", "IP", "127.0.0.1") Local $port = IniRead($konfig_ini, "RecordingService", "Port", 80) Local $srequest = '/tasks.html?task=' & $stask & "&aktion=tasks" Local $sHeader, $authorization = _Base64Encode($user & ':' & $pass) Local $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 GTB7.1") Local $hConnect = _WinHttpConnect($hOpen, $IP, $port) If @error Then _FileWriteLog($log, "_Sendrequest - Fehler beim Verbinden mit dem Webserver INI überprüfen!", 1) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Return EndIf Local $hRequest = _WinHttpOpenRequest($hConnect, 'GET', $srequest) _WinHttpSendRequest($hRequest, 'Authorization: Basic ' & $authorization) _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) Local $data = '' Do $data &= _WinHttpReadData($hRequest) Until @error If $exendetlog Then _FileWriteLog($log, 'process task=' & $stask, 1) If $exendetlog Then _FileWriteLog($log, 'prozcss task return message: ' & $data, 1) _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen)EndFunc ;==>_Sendrequest Func _Base64Encode($sData) ; keine Ahnung von wem die Funktion is (nicht von mir) Local $oXml = ObjCreate("Msxml2.DOMDocument") If Not IsObj($oXml) Then SetError(1, 1, 0) EndIf Local $oElement = $oXml.createElement("b64") If Not IsObj($oElement) Then SetError(2, 2, 0) EndIf $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text If StringLen($sReturn) = 0 Then SetError(3, 3, 0) EndIf Return $sReturnEndFunc ;==>_Base64Encode Edited March 16, 2013 by nuts Quote
-lahna Posted March 17, 2013 Author Posted March 17, 2013 Thanks but I don't use the RecordingService. I only have a DVBViewer Pro. Quote
-lahna Posted March 19, 2013 Author Posted March 19, 2013 I found an answer. Here for other newbies. VBscript option explicit Dim DVB Set DVB = getobject(, "DVBViewerServer.DVBViewer") DVB.OSD.execproc("cleanRecordDB") DVB.OSD.execproc("compressRecordDB") DVB.OSD.execproc("refreshRecordDB") Set DVB = nothing Quote
Tüftler Posted March 19, 2013 Posted March 19, 2013 (edited) I found an answer. Here for other newbies. VBscript option explicit Dim DVB Set DVB = getobject(, "DVBViewerServer.DVBViewer") DVB.OSD.execproc("cleanRecordDB") DVB.OSD.execproc("compressRecordDB") DVB.OSD.execproc("refreshRecordDB") Set DVB = nothing Or you use the ActionCommands -> http://de.DVBViewer.tv/wiki/Actions.ini Dim DVB Set DVB = getobject(, "DVBViewerServer.DVBViewer") DVBViewer.SendCommand(8261) 'cleanRecordDB DVBViewer.SendCommand(8262) 'compressRecordDB DVBViewer.SendCommand(8263) 'refreshRecordDB Set DVB = nothing Edited March 19, 2013 by Tüftler Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.