onlydarksets

Just another WordPress.com weblog

Getting metadata from WMV files

Posted by onlydarksets on May 10, 2008

Update: Here is a better description of the solution.

Andy posted some code a while back to get metadata from a DVR-MS file, and I needed something similar for WMV.  Luckily, it seems to work on any file with metadata.  It won’t grab it all (e.g., season and episode), but it gets a lot of it.  Here’s the adapted code:

sub GetFileProperties(inFilePath)
    dim title, subtitle, folderName, fileName, createDate
    dim objShell, objFolder
    Dim fso, item, f

    Set fso = CreateObject(“Scripting.FileSystemObject”)
    Set objShell = CreateObject(“Shell.Application”)

    folderName = fso.GetParentFolderName(inFilePath)
    fileName = fso.GetFileName(inFilePath)

    Set objFolder = objShell.Namespace(folderName) 
    set item = objFolder.ParseName(fileName)
    Wscript.Echo item.name
    Wscript.Echo objFolder.GetDetailsOf(item, 10)

    Wscript.Echo “(1) Filesize: ” & objFolder.GetDetailsOf(item, 1)
    Wscript.Echo “(2) File type: ” & objFolder.GetDetailsOf(item, 2)
    Wscript.Echo “(3) Created Date: ” & objFolder.GetDetailsOf(item, 3)
    Wscript.Echo “(4) Modified Date: ” & objFolder.GetDetailsOf(item, 4)
    Wscript.Echo “(5) Accessed Date: ” & objFolder.GetDetailsOf(item, 5)
    Wscript.Echo “(6) Attrib?: ” & objFolder.GetDetailsOf(item, 6)
    Wscript.Echo “(7) ?: ” & objFolder.GetDetailsOf(item, 7)
    Wscript.Echo “(8) User: ” & objFolder.GetDetailsOf(item, 8)
    Wscript.Echo “(10) **Series Name: ” & objFolder.GetDetailsOf(item, 10)
    Wscript.Echo “(21) **Show Length: ” & objFolder.GetDetailsOf(item, 21)
    Wscript.Echo “(22) **Bitrate: ” & objFolder.GetDetailsOf(item, 22)
    Wscript.Echo “(23) ?: ” & objFolder.GetDetailsOf(item, 23)
    Wscript.Echo “(26) **Resolution: ” & objFolder.GetDetailsOf(item, 26)
    Wscript.Echo “(27) **Horizontal Res: ” & objFolder.GetDetailsOf(item, 27)
    Wscript.Echo “(28) **Vertical Res: ” & objFolder.GetDetailsOf(item, 28)
    Wscript.Echo “(29) **Episode Name: ” & objFolder.GetDetailsOf(item, 29)
    Wscript.Echo “(30) **Episode Description: ” & objFolder.GetDetailsOf(item, 30)
    Wscript.Echo “(32) **Audio bits: ” & objFolder.GetDetailsOf(item, 32)
    Wscript.Echo “(33) **Audio kHz: ” & objFolder.GetDetailsOf(item, 33)
    Wscript.Echo “(34) **Audio channels: ” & objFolder.GetDetailsOf(item, 34)

    set f = nothing
    set item = nothing

    set objFolder = nothing
    set objShell = nothing
    set fso = nothing
end sub

dim args
set args = wscript.arguments

GetFileProperties args(0)

set args = nothing
‘——————————————————————-

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: