Jump to content

Getting metadata infos via DllCall


Recommended Posts

Hi all!

I'm really struggling with DllCall for getting metadata out of a video file with "Toub.MediaCenter.Dvrms.dll". There is a working PowerShell script that makes use of it:

## metaname.ps1 ##
# get the Toub.MediaCenter.Dvrms.dll from the dvrms toolkit site and save in in c:\
# if you save it somewhere else, change the path below
[void][System.Reflection.Assembly]::LoadFile("C:\Toub.MediaCenter.Dvrms.dll")

# set the vars below to fit your situation
$source="e:\recorded tv"
$target="e:\recorded tv"

# this loop gets the Title, Subtitle, and Description from each wtv file and renames it
foreach ($file in gci "$source\*.wtv") {
$wtv = New-Object Toub.Mediacenter.Dvrms.Metadata.DvrmsMetadataEditor($file)
$attrlist = $wtv.GetAttributes()

# you can add or remove other metadata as you see fit
$t = $attrlist["Title"].value -replace(":","-")
$s = $attrlist["WM/SubTitle"].value -replace(":","-")
$d = $attrlist["WM/SubTitleDescription"].value -replace(":","-")

# the multiple moves below handle cases of duplicates and long descriptions, only one will actually work.
move "$file" "$target\$t-$s-$d.wtv"
move "$file" "$target\$t-$s-$d-2.wtv"
move "$file" "$target\$t-$s-$d-3.wtv"
move "$file" "$target\$t-$s.wtv"
move "$file" "$target\$t-$s-2.wtv"
move "$file" "$target\$t-$s-3.wtv"
}

I want to get a single metainfo from a given video file (not looping through a folder like in the script above) within AutoIt. But honestly i don't know how to achieve that. I already tried everything i could imagine but i got no info out of it. Currently i have this code:

#include <Array.au3>

$myFile = "F:\TEST\MyTestfile.wtv"
$dll = DllOpen("Toub.MediaCenter.Dvrms.dll")

$result = DllCall($dll, "str", "GetAttributes", _
                    "str", $myFile, _
                    "str", "WM/Genre")

_ArrayDisplay($result)
DllClose($dll)

I also tried to get the infos by making an object (ObjCreate) but that didn't work either. I assume i cannot DllOpen the dll and create an Object then? It has to be registered to the system first, right? I want to make it portable, so i don't want to register the dll.

The sourcecode of the dll can be found here, if there are any functions that have to be considered.

If someone could point me to a direction, i would be very grateful!

Thanks!

Link to comment
Share on other sites

Ok - i think i found the problem. The dll is written in .NET which - for my understanding - is no able to be called via AutoIt DllCall. Can be wrong though. Anyways, it doesn't work with this dll.

For all who want to know my solution and came across here by chance: i've done a pretty dirty workaround by using ffmpeg.exe to analyze the WTV stream and extract the desired metadata via stdout/stderr... :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...