View Full Version : PowerDVD & DVDSpy scripts

October 30th, 2002, 11:30 PM
When I first started using DVDSpy, I quickly found out that there was not much functionality for PowerDVD. I then took it upon myself to spend a weekend figure out how to extend Girders capabilities with PowerDVD as I truly love this player ;-)

First problem: elapsed time doesn't work. I did some logging and found that all of the information was actually still being sent to pld1 but in parts. It would send the hours and minutes in a fraction of a second then send the second and wait for 1 sec. The attached Lua code stores these values as Girder variables then parses it into an easy to read HH:MM:SS format. The script will fail sometimes when switching from seconds to a minute but will always auto correct within a few seconds.

if (log1 == nil) then
log1 = 0
log2 = 0
log3 = 0
seconds = 0
minutes = 0
hours = 0

log3 = log2
log2 = log1
log1 = pld1

seconds = log1
minutes = log2

-- if these conditions fall through the hour will correct without 2-3 seconds
if&#40;&#40;log3 + 1&#41; ~= &#40;log1 + 0&#41;&#41; and &#40;&#40;log3 + 0&#41; < 4&#41; then
hours = log3

elapsed = strsub&#40;hours .. "0", 0, 2&#41; .. "&#58;" .. strsub&#40;minutes .. "0", 0, 2&#41; .. "&#58;" .. strsub&#40;seconds .. "0", 0, 2&#41;

Next problem: DVDSpy has no capability to extract the DVD or CD title... I've developed a VBScript that does a simple check on the volume name of the DVD/CD drive and calls ievence.exe - passing this information to pld2. You will have to use lua to assign pld2 to a variable...

SET fso = WScript.CreateObject&#40;"Scripting.FileSystemObject"&#41;
SET shell = WScript.CreateObject&#40;"WScript.shell"&#41;
SET drive = fso.GetDrive&#40;"D"&#41;

shell.run "C&#58;\Progra~1\girder32\ieventc.exe 1024 null DVDTitle " & Left&#40;drive.VolumeName, 14&#41;

Final problem: To keep things simple I'm using PowerDVD to also play my audio CD's. I needed a way to have Girder tell of the disk in the drive was a DVD or a CD. To do this I developed yet another VBScript that checks the size of the disk, if its smaller than 750mb then the script sends to ieventc.exe a pld2 of CD - otherwise a pld2 of DVD.

SET fso = CreateObject&#40;"Scripting.FileSystemObject"&#41;
SET shell = WScript.CreateObject&#40;"WScript.shell"&#41;
Set drive = fso.GetDrive&#40;"D&#58;\"&#41;.RootFolder

size = drive.size

IF&#40;size < 750000000&#41; THEN
shell.run "C&#58;\Progra~1\girder32\ieventc.exe 1024 null DVDorCD CD"
shell.run "C&#58;\Progra~1\girder32\ieventc.exe 1024 null DVDorCD DVD"

I hope these script help out, feel free to give me a reply if it does - love to hear your comments.


October 31st, 2002, 11:54 AM
You use the following for formatting:

elapsed = strsub&#40;hours .. "0", 0, 2&#41; .. "&#58;" .. strsub&#40;minutes .. "0", 0, 2&#41; .. "&#58;" .. strsub&#40;seconds .. "0", 0, 2&#41;
You might want to give the format() function a try:

elapsed = format&#40;"%2d&#58;%2d&#58;%2d", hours, minutes, seconds&#41;
I think it will be faster and easier to read/understand.

October 31st, 2002, 01:35 PM
Thanks vynce, that definately is a lot easier to understand.


October 31st, 2002, 02:45 PM

Are you using the latest built (1.45) of DVDSpy? On my system, it fixed the elapsed time issue

Otherwise, great additions!