misc:powershell
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
misc:powershell [2012/10/05 04:31] – WlaXofNoS 188.143.232.12 | misc:powershell [2012/10/07 04:05] (current) – Reverted vandalism 98.248.89.12 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | That's a sensible answer | + | ====== Powershell scripts ====== |
+ | |||
+ | ===== Amazon artwork grabber ===== | ||
+ | If you like storing all your album art in a single folder here is a quick and dirty Windows Powershell script that automatically grabs artwork from Amazon for all tracks in your foobar2000 Media Library (using foo_comserver2). It works reasonably well but could still be improved. | ||
+ | |||
+ | You'll need to modify the script | ||
+ | |||
+ | I would have made it a proper Powershell script but I was put off by the restrictions in place by default on executing those so you'll just have to copy and paste it to the prompt and press enter a couple times if needed. | ||
+ | |||
+ | < | ||
+ | $store = " | ||
+ | $AWSAccessKeyId = | ||
+ | |||
+ | [System.Reflection.Assembly]:: | ||
+ | |||
+ | $fb2k = new-object -comObject Foobar2000.Application.0.7 | ||
+ | $web = (new-object System.Net.WebClient) | ||
+ | $ml = $fb2k.MediaLibrary | ||
+ | |||
+ | #comserver needs updating! | ||
+ | #$tracks = $ml.GetSortedTracks($script," | ||
+ | $tracks = $ml.GetSortedTracks($script," | ||
+ | |||
+ | $fmt = @() | ||
+ | $albums = @() | ||
+ | |||
+ | for ($i=0; $i -lt $tracks.Count; | ||
+ | for ($i=1; $i -lt $fmt.Count; $i++) {if ($fmt[$i-1] -ne $fmt[$i]) {$albums += $fmt[$i-1]}} | ||
+ | if ($fmt.Count) {$albums += $fmt[$fmt.Count-1]} | ||
+ | |||
+ | foreach ($album in $albums) | ||
+ | { | ||
+ | $albumsafe = $album | ||
+ | $albumsafe = $albumsafe.Replace("?","" | ||
+ | $albumsafe = $albumsafe.Replace(":","" | ||
+ | $albumsafe = $albumsafe.Replace("/","" | ||
+ | $albumsafe = $albumsafe.Replace(" | ||
+ | $albumsafe = $albumsafe.Replace(" | ||
+ | $albumsafe = $albumsafe.Replace(" | ||
+ | $path = $store + $albumsafe + " | ||
+ | |||
+ | if (!(Test-Path($path))) | ||
+ | { | ||
+ | $xml = [xml]$web.DownloadString(" | ||
+ | Sleep -seconds 1 | ||
+ | foreach ($item in $xml.ItemSearchResponse.Items.Item) | ||
+ | { | ||
+ | if ($album.Contains($item.ItemAttributes.Title) -and $item.LargeImage) | ||
+ | { | ||
+ | $web.DownloadFile($item.LargeImage.URL, | ||
+ | Sleep -seconds 1 | ||
+ | break | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }</ |
misc/powershell.1349411485.txt.gz · Last modified: 2012/10/05 04:31 by 188.143.232.12