Lerch Web Wiki

Random, erratic, no responsibility is taken for the correctness of this information

User Tools

Site Tools


powershell:basics:media

Working with Media Files

Read-MP3Tag.ps1
$files = gci .\Music -Include *.mp3,*.wma -Force -Recurse -ErrorAction SilentlyContinue
 
$wmp = New-Object -com wmplayer.ocx
 
$metaData = @()
 
foreach ($file in $files)
{
       $media = $wmp.newMedia($file.FullName)
 
       $hash = @{}
       0..($media.attributeCount - 1) | ? { $media.getItemInfo($media.getAttributeName($_)) } | 
         % { $hash[$media.getAttributeName($_)] = $media.getItemInfo($media.getAttributeName($_)) }
 
       $metaData += [PSCustomObject]$hash
}
 
$metaData | Export-Csv -Path "$($pwd.Path)\metaData.csv" -NoTypeInformation
powershell/basics/media.txt · Last modified: 2017/02/21 11:13 by marcus