2015-07-25, 04:31
Build 149 does just that - try it
Glenn
Glenn
set-executionpolicy bypass
$currentlyPlayingArtist = $NULL
$logfile = "C:\Users\MKANET\Desktop\invalid-urls.log"
if ($logfile){del $logfile -ErrorAction SilentlyContinue}
$artistFolders = dir ([environment]::getfolderpath("MyMusic")) -Attributes Directory -Exclude "*My Music*"
$MusicDirPath = ([environment]::getfolderpath("MyMusic"))
#Music Directory Path Override:
#$MusicDirPath = "$($PSScriptRoot)\Fanart"
$url = "http://127.0.0.1:8091/jsonrpc?request={`"jsonrpc`": `"2.0`", `"method`": `"Player.GetItem`", `"params`": { `"properties`": [`"artist`"], `"playerid`": 0 }, `"id`": `"AudioGetItem`"}"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("Content-Type", "application/json")
$wc.Encoding = [System.Text.Encoding]::UTF8
try {$json = $wc.DownloadString($url)} catch {}
$wc.dispose();
$currentlyPlayingArtist = $json | ConvertFrom-Json -ErrorAction SilentlyContinue | select -ExpandProperty result -ErrorAction SilentlyContinue | select -ExpandProperty item -ErrorAction SilentlyContinue | select -ExpandProperty artist -ErrorAction SilentlyContinue
if ($currentlyPlayingArtist) {
mkdir "$($MusicDirPath)\$($currentlyPlayingArtist)\extrafanart" -force | out-null
$processArtistFolder = "$($MusicDirPath)\$($currentlyPlayingArtist)"
if (!(test-path "$($processArtistFolder)\extrafanart\fanart*.jpg")) {
write-host "Downloading fanart for: $($currentlyPlayingArtist)"
#if(!(gi $MusicDirPath)) {write-host "No songs to process"; exit}
$artistFolder = gi "$($MusicDirPath)\$($currentlyPlayingArtist)"
$wc = New-Object System.Net.WebClient
$wc.Headers.Add("api-key","d5d51752e041d15ed2277084f47e6252")
[System.Reflection.Assembly]::LoadWithPartialName("System.web") | out-null
$artist = $currentlyPlayingArtist
$artist = [System.Web.HttpUtility]::UrlEncode($artist);
$url = "https://fanart.tv/?s=$artist§=2"
$result = $wc.DownloadString($url)
$artist = $currentlyPlayingArtist.replace(" ","-")
$result -match "(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}(?=/$artist|)" | out-null
$artistID = $matches | select -ExpandProperty Values
#$artistID = "6e650a01-6489-4dc8-85e1-8ec809dd72a2"
$url = "http://private-anon-55574de17-fanarttv.apiary-proxy.com/v3/music/$artistID"
$wc.Headers.Add("Content-Type", "application/json")
$json = $wc.DownloadString($url)
$jsonArtist = $NULL
$artistbackgroundURLS = $NULL
$jsonArtist = $json | ConvertFrom-Json
$artistbackgroundURLS = $jsonArtist | select -ExpandProperty artistbackground -ErrorAction SilentlyContinue | select -ExpandProperty url -ErrorAction SilentlyContinue
if ($artistbackgroundURLS.count -gt 8) {$MaxArtistBackgrounds = 8} else {$MaxArtistBackgrounds = $artistbackgroundURLS.count}
try {
if ($MaxArtistBackgrounds -gt 1) {
$wc.Headers.Set("Content-Type", "image/jpeg")
for ($i=0;$i -lt $MaxArtistBackgrounds; $i++) {
$wc.DownloadFile($artistbackgroundURLS[$i], "$($MusicDirPath)\$($artistFolder.Name)\extrafanart\fanart$($i+1).jpg")
}
} else {
$wc.DownloadFile($artistbackgroundURLS, "$($MusicDirPath)\$($artistFolder.Name)\extrafanart\fanart1.jpg")
}
} catch {
$wc.dispose();
$wc = New-Object System.Net.WebClient
#Insert your FanArt.TV Project api-key below:
$wc.Headers.Set("api-key","dsdaasd5d51752e041d15ed22770dsdwsd252")
$artist = $currentlyPlayingArtist
$artist = [System.Web.HttpUtility]::UrlEncode($artist);
$url = "https://musicbrainz.org/search?query=$($artist)&type=artist&limit=1&method=indexed"
$result = $wc.DownloadString($url)
$result -match "(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}" | out-null
$artistID = $Matches[0]
$url = "http://private-anon-55574de17-fanarttv.apiary-proxy.com/v3/music/$artistID"
$wc.Headers.Add("Content-Type", "application/json")
$json = $wc.DownloadString($url)
$jsonArtist = $NULL
$artistbackgroundURLS = $NULL
$jsonArtist = $json | ConvertFrom-Json
$artistbackgroundURLS = $jsonArtist | select -ExpandProperty artistbackground -ErrorAction SilentlyContinue | select -ExpandProperty url -ErrorAction SilentlyContinue
if ($artistbackgroundURLS.count -gt 8) {$MaxArtistBackgrounds = 8} else {$MaxArtistBackgrounds = $artistbackgroundURLS.count}
if ($MaxArtistBackgrounds -gt 1) {
$wc.Headers.Set("Content-Type", "image/jpeg")
for ($i=0;$i -lt $MaxArtistBackgrounds; $i++) {
$wc.DownloadFile($artistbackgroundURLS[$i], "$($MusicDirPath)\$($artistFolder.Name)\extrafanart\fanart$($i+1).jpg")
}
} else {
$wc.DownloadFile($artistbackgroundURLS, "$($MusicDirPath)\$($artistFolder.Name)\extrafanart\fanart1.jpg")
}
}
#$errURLs = (gc $logfile).Replace("http://private-anon-55574de17-fanarttv.apiary-proxy.com/v3/music/","https://musicbrainz.org/artist/")
} else {
"Fanart already exists for: $currentlyPlayingArtist"
if (!(Get-Process Yatse2)) {invoke-item "C:\Program Files (x86)\Yatse Socket\Yatse2.exe"}
$FanartExists = $True
}
<# if ($artistbackgroundURLS) {
Get-Process Yatse2 -ErrorAction SilentlyContinue | Stop-Process
invoke-item "C:\Program Files (x86)\Yatse Socket\Yatse2.exe"
}#>
} else {
write-host "No songs playing"
}
if (!(Get-Process Yatse2)) {invoke-item "C:\Program Files (x86)\Yatse Socket\Yatse2.exe"}
Get-ChildItem $MusicDirPath -recurse | Where {$_.PSIsContainer -and @(Get-ChildItem -Lit $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse
(2015-09-09, 15:07)dougfoot Wrote: Good Morning, I'm hoping to find an answer...
Attempting to install the Yatse plugin for kodi, however I'm getting an appcrash error:
Fault bucket 207215247, type 25
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: Yatse2.service.Setup.exe
P2: 0.0.0.0
P3: 558d6dc0
P4: Yatse2.service.Setup.exe
P5: 0.0.0.0
P6: 558d6dc0
P7: c0000005
P8: 00005f39
P9:
P10:
Attached files:
C:\Users\htpc\AppData\Local\Temp\WER7AAC.tmp.WERInternalMetadata.xml
These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_Yatse2.service.S_d84c6f1a5f4798ea48a6a2b87310e2ead54d56_23399af8
Analysis symbol:
Rechecking for solution: 0
Report Id: 5591705c-56f3-11e5-a24d-e03f49af186d
Report Status: 0
Thank you for your time.