PDA

View Full Version : PowerDVD & DVDSpy scripts


obsidience
October 30th, 2002, 10:29 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
end

log3 = log2
log2 = log1
log1 = pld1

seconds = log1
minutes = log2

-- if these conditions fall through the hour will correct without 2-3 seconds
if((log3 + 1) ~= (log1 + 0)) and ((log3 + 0) < 4) then
hours = log3
end

elapsed = strsub(hours .. "0", 0, 2) .. ":" .. strsub(minutes .. "0", 0, 2) .. ":" .. strsub(seconds .. "0", 0, 2)


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("Scripting.FileSystemObject")
SET shell = WScript.CreateObject("WScript.shell")
SET drive = fso.GetDrive("D")

shell.run "C:\Progra~1\girder32\ieventc.exe 127.0.0.1 1024 null DVDTitle " & Left(drive.VolumeName, 14)


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("Scripting.FileSystemObject")
SET shell = WScript.CreateObject("WScript.shell")
Set drive = fso.GetDrive("D:\").RootFolder

size = drive.size

IF(size < 750000000) THEN
shell.run "C:\Progra~1\girder32\ieventc.exe 127.0.0.1 1024 null DVDorCD CD"
ELSE
shell.run "C:\Progra~1\girder32\ieventc.exe 127.0.0.1 1024 null DVDorCD DVD"
END IF



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

Obsidience

vynce
October 31st, 2002, 10:54 AM
You use the following for formatting:
elapsed = strsub(hours .. "0", 0, 2) .. ":" .. strsub(minutes .. "0", 0, 2) .. ":" .. strsub(seconds .. "0", 0, 2)
You might want to give the format() function a try:
elapsed = format("%2d:%2d:%2d", hours, minutes, seconds)
I think it will be faster and easier to read/understand.

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

Obsidience

Francois
October 31st, 2002, 01:44 PM
Obsidience,

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

Otherwise, great additions!