Jump to content

Light from led when recording


Thomas

Recommended Posts

there are interfaces like the com interface where you can query the recording status. Or use things like eventghost. It depens on the interface to the led. I think it might be possible. The Imon LCD Plugin for example shows an icon when DVBViewer is recording(doesn't work with rec. service though)

Link to comment

I'm using rec. service so I think it will be a problem. But I have connected my led like this My link

I'm not sure which plugin to use in eventghost to make it work.

Edited by Thomas
Link to comment

I'm using rec. service so I think it will be a problem. But I have connected my led like this My link

I'm not sure which plugin to use in eventghost to make it work.

Well, you dont have to use the DVBViewer COM interface to get recording status. If you are using Recording Service you can get recording status with the URLdownloadToVariable script and build your script from there.

http://www.DVBViewer.tv/forum/topic/41069-recording-service-status-into-a-variable/

Link to comment

Well, you dont have to use the DVBViewer COM interface to get recording status. If you are using Recording Service you can get recording status with the URLdownloadToVariable script and build your script from there.

http://www.DVBViewer.tv/forum/topic/41069-recording-service-status-into-a-variable/

 

I now nothing of building scipts. Can you spell it out for me?

Edited by Thomas
Link to comment

I now nothing of building scipts.

Time to start learning, especially when you want something cool and it doesnt work with your favorite software :)

You would need a persistant script monitoring recordingservice recording status. Whenever RS trayicon turns red (recording in progress) your script triggers and runs the software which is controlling the LED light. When RS turns idle the LED turns off. The hard part would be if you cant control your led driver somehow...in other words can you make the led light glow when you like in any way and if so how?

Link to comment

I use this program. ledsDriver And with the led connected to a com port I can make it glow with the commands build into the program. However most of the commands are for when you use WMC. But for example if I choose power on it will glow when the pc is running and program is loaded. Don't know if that helps.

Link to comment

Seems you have all the components then to get this to work. Don't expect me to write it for you. I have too little time on my hands right now. A good tip is to visit the Autohotkey site and start learning the basics (it isnt that hard I can assure you that). Do lots of searches there is a good chance somebody else already did what you are after and ask for help if you stumble over troubles you cant manage to solve. Download the autohotkey software and test the script i did post in the thread i did link to earlier.

 

Here you will find everything you need to get started.

http://www.autohotkey.com/docs/commands.htm

http://www.autohotkey.com/forum/index.php?sid=4248f167b223da681412f5cb0cc014b2

Good luck!

:bye:

Link to comment
Download the autohotkey software and test the script i did post in the thread i did link to earlier.

 

How do I test it. Write it in notepad and save as a xml file but where?

And what does the script that you wrote do exactly?

Edited by Thomas
Link to comment

1) Download autohotkey and install it on your PC http://www.autohotkey.com/download/

2) Copy the code in the script and paste it into a notepad sheet and save it as whateveryoulike.ahk

3) Fill in your own username and password for Recording Service where the x are in the script and save.

4) Doubleclick on the .ahk and you will see the result on a messagebox...the value/status for the recording service.

5) Use that script as a base and continue filling it with the other components you need.

Link to comment

I did look in to this and quickly threw together some code that might work for you. The easiest way was to make three scripts.

One autostart script and two monitoring recording status scripts. Instead of switching a LED light on and off I tested with switching channels on the DVBViewer client. If recording service gets busy DVBViewer switches to channel 2 and if recording service gets idle DVBViewer switches to channel 1. You only need to swap that code with your ledDriver commands.

Won't give you any more information than that...hopefully you could figure out the rest for yourself.

Good luck!

 

 

Autostart Script:

 

Sleep, 20000 ;Delays execution of autostartscript as long as you need (20 seconds in this example) until Recording Service is started. If RS is not started no status value and script fails.
OutputVar := UrlDownloadToVar("http://xxxx:xxxxx@127.0.0.1:8075/api/status.html")
FoundPos := RegExMatch(OutputVar, "(?<=recordcount>)(.)", SubPat)
;MsgBox, % SubPat

UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
AutoTrim, Off
hModule := DllCall("LoadLibrary", "str", "wininet.dll") 

If (Proxy != "")                                                          
AccessType=3
Else
AccessType=1
;INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
;INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
;INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS

io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags

iou := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext

If (ErrorLevel != 0 or iou = 0) {
DllCall("FreeLibrary", "uint", hModule)
return 0
}

VarSetCapacity(buffer, 512, 0)
VarSetCapacity(NumberOfBytesRead, 4, 0)
Loop
{
 irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
 NOBR = 0
 Loop 4  ; Build the integer by adding up its bytes. - ExtractInteger
   NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
 IfEqual, NOBR, 0, break
 ;BytesReadTotal += NOBR
 DllCall("lstrcpy", "str", buffer, "uint", &buffer)
 res = %res%%buffer%
}
StringTrimRight, res, res, 2

DllCall("wininet\InternetCloseHandle",  "uint", iou)
DllCall("wininet\InternetCloseHandle",  "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
AutoTrim, on
return, res
}

if SubPat >= 1
 {
   Run, REC0.ahk, E:\ ;Gets your monitoring scripts into the right phasing
Return
 }
else 
 {
   Run, REC1.ahk, E:\ ;Gets your monitoring scripts into the right phasing
Return
 }

 

 

Monitoring RS going from 0 to 1:

REC1.ahk

 

;#NoTrayIcon
#Persistent
SetTimer, CheckRecordingStatus1, 250 ;Check every quarter-second
return

CheckRecordingStatus1:
OutputVar := UrlDownloadToVar("http://xxxx:xxxxx@127.0.0.1:8075/api/status.html")
FoundPos := RegExMatch(OutputVar, "(?<=recordcount>)(.)", SubPat)
;MsgBox, % SubPat

UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
AutoTrim, Off
hModule := DllCall("LoadLibrary", "str", "wininet.dll") 

If (Proxy != "")                                                          
AccessType=3
Else
AccessType=1
;INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
;INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
;INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS

io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags

iou := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext

If (ErrorLevel != 0 or iou = 0) {
DllCall("FreeLibrary", "uint", hModule)
return 0
}

VarSetCapacity(buffer, 512, 0)
VarSetCapacity(NumberOfBytesRead, 4, 0)
Loop
{
 irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
 NOBR = 0
 Loop 4  ; Build the integer by adding up its bytes. - ExtractInteger
   NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
 IfEqual, NOBR, 0, break
 ;BytesReadTotal += NOBR
 DllCall("lstrcpy", "str", buffer, "uint", &buffer)
 res = %res%%buffer%
}
StringTrimRight, res, res, 2

DllCall("wininet\InternetCloseHandle",  "uint", iou)
DllCall("wininet\InternetCloseHandle",  "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
AutoTrim, on
return, res
}

if SubPat >= 1 ; Recording is going on
 {
   SetTimer, CheckRecordingStatus1, Off
   ;Here you insert your commands for the ledsDriver software. Power On LED is needed here.
   ;You must figure out if you can trigger the LED light On/Off with a keyboardcommand (preferrable) or mouseclicks (often not failsafe)
   ;The format for how you master these commands you must figure out on your own...it is basic stuff! Good luck!
   WinActivate, DVBViewer 
   Send, 2
   Run, REC0.ahk, E:\
   ExitApp
   return
 }

 

 

Monitoring RS going from 1 to 0:

REC0.ahk

 

;#NoTrayIcon
#Persistent
SetTimer, CheckRecordingStatus0, 250 ;Check every quarter-second
return

CheckRecordingStatus0:
OutputVar := UrlDownloadToVar("http://xxxxx:xxxxx@127.0.0.1:8075/api/status.html")
FoundPos := RegExMatch(OutputVar, "(?<=recordcount>)(.)", SubPat)
;MsgBox, % SubPat

UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
AutoTrim, Off
hModule := DllCall("LoadLibrary", "str", "wininet.dll") 

If (Proxy != "")                                                          
AccessType=3
Else
AccessType=1
;INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
;INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
;INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS

io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags

iou := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext

If (ErrorLevel != 0 or iou = 0) {
DllCall("FreeLibrary", "uint", hModule)
return 0
}

VarSetCapacity(buffer, 512, 0)
VarSetCapacity(NumberOfBytesRead, 4, 0)
Loop
{
 irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
 NOBR = 0
 Loop 4  ; Build the integer by adding up its bytes. - ExtractInteger
   NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
 IfEqual, NOBR, 0, break
 ;BytesReadTotal += NOBR
 DllCall("lstrcpy", "str", buffer, "uint", &buffer)
 res = %res%%buffer%
}
StringTrimRight, res, res, 2

DllCall("wininet\InternetCloseHandle",  "uint", iou)
DllCall("wininet\InternetCloseHandle",  "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
AutoTrim, on
return, res
}

if SubPat = 0 ;No recording
 {
   SetTimer, CheckRecordingStatus0, Off
   ;LED light off command here
   WinActivate, DVBViewer
   Send, 1
   Run, REC1.ahk, E:\
   ExitApp
   return
 }

Edited by majstang
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...