Last active
December 13, 2015 23:38
-
-
Save alwalker/4992589 to your computer and use it in GitHub Desktop.
Powershell script for converting flac files to low quality mp3's for use in car stereo. Replaces artist tags with album artist information for easy navigation in car audio systems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear | |
$files = get-childitem "F:\Work_Area\Music\Raw" *.flac -rec | |
foreach ($file in $files) | |
{ | |
$artist = metaflac $file.fullname --show-tag=ALBUMARTIST | |
if(!$artist -or !$artist.split("=")[1]) {$artist = metaflac $file.fullname --show-tag=ARTIST} | |
$artist = $artist.split("=") | |
$artist = $artist[1..($artist.length-1)] -join "=" | |
$title = (metaflac $file.fullname --show-tag=TITLE).split("=") | |
$title = $title[1..($title.length-1)] -join "=" | |
$album = (metaflac $file.fullname --show-tag=ALBUM).split("=") | |
$album = $album[1..($album.length-1)] -join "=" | |
$genre = (metaflac $file.fullname --show-tag=GENRE).split("=") | |
$genre = $genre[1..($genre.length-1)] -join "=" | |
$tracknumber = metaflac $file.fullname --show-tag=TRACKNUMBER | |
$tracknumber = $tracknumber.split("=")[1] | |
if(!(Test-Path "F:\Work_Area\Music\Car\$artist\$album")) | |
{ | |
New-Item "F:\Work_Area\Music\Car\$artist\$album" -type directory | |
} | |
$mp3 = "F:\Work_Area\Music\Car\$artist\$album\" + $file.tostring().Replace(".flac", ".mp3") | |
$wav = $file.fullname.Replace(".flac", ".wav") | |
flac -d $file.Fullname | |
lame -V4 --add-id3v2 --pad-id3v2 --ignore-tag-errors --nohist --tt $title --ta $artist --tl $album --tn $tracknumber --tg $genre $wav $mp3 | |
Remove-Item $wav | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment