Types.ps1xml
<?xml version="1.0" encoding="utf-8" ?> <Types> <Type> <Name>TagLib.MusicItem</Name> <Members> <ScriptProperty> <Name>Image</Name> <GetScriptBlock> $Cover = $this.Pictures | Select-Object -First 1 if ($Cover.MimeType -eq 'image/jpeg') { $Bytes = $Cover.Data | Foreach-Object { [byte] $_ } $OutFile = [System.IO.Path]::GetTempFileName() -replace '.tmp', '.jpg' [System.IO.File]::WriteAllBytes($OutFile, $Bytes) open $OutFile } </GetScriptBlock> </ScriptProperty> <ScriptProperty> <Name>Artist</Name> <GetScriptBlock> $this.FirstArtist ?? $this.FirstPerformer ?? $this.FirstAlbumArtist </GetScriptBlock> </ScriptProperty> </Members> </Type> </Types> |