Jump to content

VBS Refresh Recording Database


-lahna

Recommended Posts

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 $sReturn
EndFunc ;==>_Base64Encode

Edited by nuts
Link to comment

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
Link to comment

 

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 by Tüftler
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...