6

So over the years between getting copied from one PC/hard drive to the next, my music collection is in a bit of a mess, so I want to go through each one programmatically and update the file metadata in the below screenshot (from right click > Properties on the file):

enter image description here

Some of the files are MP3 so I know ID3 can be used there (I had tried using Get-Content to view the last 128 bytes where the ID3 tags go, but only some small bits show as readable text, assuming this is because it's a binary file and needs decoded/parsed in some specific way). About an equal number are WMA (quite an old codec version, probably 7 or 8) and some are uncompressed WAV.

So I possibly need two things:

a) a way to access and update the ID3 info for the MP3 type files b) a way to access the File Properties (at the Windows level) for WMA and WAV; if this method would also work for MP3 that'd be fantastic

Anyone got any ideas? I know this is possible in C# but that's a bit over my head right now as more used to scripting. If it needs to be done in a proper compiled program so be it but hoping there's a way to do it in shell.

Thomas Gass
  • 163
  • 1
  • 5
  • looks like this does it https://devblogs.microsoft.com/scripting/list-music-file-metadata-in-a-csv-and-open-in-excel-with-powershell/ – Hashbrown Jul 30 '20 at 06:16

1 Answers1

6

Download the tagsharp.dll from HERE.

There is a separate module which can be used to modify any of the meta data like:

get-childitem mylocal.mp3 | set-album "MyLocalAlbum"

or something like this :

$files = Get-ChildItem D:\Folder -include *.mp3 -recurse 
[System.Reflection.Assembly]::LoadFile("C:\TagLibDirectory\taglib-sharp.dll" ) 

foreach($iFile in $files) 
{ 
    $iFile.fullname    
    $mediaFile=[TagLib.File]::Create($iFile.fullname)    
    $mediaFile.Tag.Album = $iFile.Directory.Name 
    $mediaFile.Tag.AlbumArtists=$iFile.Directory.Name 
    $mediaFile.Save()   
}

Hope it helps.

Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45
  • Yes that looks exactly like what I need, thanks. I was going to use Get-Item to generate a CSV dump of all the files, edit their properties in bulk that way, then use something like the above to do a mass update. – Thomas Gass Jul 25 '17 at 09:09
  • @ThomasGass: Acceptance of the answer would be appreciable. – Ranadip Dutta Jul 25 '17 at 09:10
  • @RanadipDutta if stock Explorer is capable of this is there any way we can do this, or even look at the taps without downloading 3rd-party software? – Hashbrown Apr 26 '20 at 06:07
  • @Hashbrown: I have not tried it. But should be possible – Ranadip Dutta Apr 28 '20 at 13:38
  • @RanadipDutta for posterity I did [end up doing it](https://gist.github.com/Hashbrown777/fae023538705a1f3f01cd795a2314e61#file-metadata-ps1) [back in Aug 2020], but I cannot add an answer since the question was closed [for some reason..]. This outputs bbcode (instead of the question's csv) but it'd be easy to change if the question ever opens up; just pwsh, no 3rd party :) – Hashbrown Jun 23 '23 at 02:17