mrsilver has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I have in my possession a Microsoft Powershell script which examines all the files in a folded ending in .wtv (Windows Media Center recorded TV programmes), extracts some metadata (using a DLL called "Toub.MediaCenter.Dvrms.dll") and then writes it to stdout.

[void][System.Reflection.Assembly]::LoadFile("C:\Toub.MediaCenter.Dvrm +s.dll") # Get all files ending in .wtv foreach ($file in gci "*.wtv") { $wtv = New-Object Toub.Mediacenter.Dvrms.Metadata.DvrmsMetadataEdito +r($file) $attrlist = $wtv.GetAttributes() # Extract the Title and Description from the recorded programme $t = $attrlist["Title"].value $d = $attrlist["WM/SubTitleDescription"].value # Print them to STDOUT "$t" "$d" }

At the moment, I run this from a Perl script and then parse the results. It works, but is messy and I'd like to drop the powershell part and do it entirely within Perl.

However, I have absolutely no idea how to link to a DLL so that I can call "GetAttributes" method on a file and then extract the values of "WM/Title" and "WM/SubTitleDescription".

Can anyone please advise me on how to do this?

Thanks in advance!

Replies are listed 'Best First'.
Re: How do I access the methods in a DLL?
by SuicideJunkie (Vicar) on Jun 10, 2010 at 18:33 UTC