getArtistArtwork($item['data']['album']['artist']['name'], true); getTrackArtwork($item['data']['album']['uri'], true); } } } // // playlists // // retrieve playlist uri from playlist name if (file_exists($w->data() . "/playlists.json")) { $json = file_get_contents($w->data() . "/playlists.json"); $json = json_decode($json, true); $playlist_file = "nonexistant"; foreach ($json as $key => $val) { $res = explode(':', $key); $playlist_name = $res[4]; $playlist_file = 'playlist_' . $playlist_name . '.json'; if (file_exists($w->data() . "/" . $playlist_file)) { $json_playlist = file_get_contents($w->data() . "/" . $playlist_file); $json_playlist = json_decode($json_playlist, true); foreach ($json_playlist as $item) { getTrackArtwork($item[2], true); } } } } if ($all_playlists == true) { echo "All Artworks for all playlists were cached"; } else { echo "All Artworks for ★ playlist were cached"; }
} $w->result("spotify_mini-spotify-" . $playlist . "-" . $item[1], $item[2] . "|||||||", ucfirst($item[0]) . " - " . $item[1], "Play track", getTrackArtwork($item[2], true), 'yes', ''); $currentResultNumber++; } $w->result('', "||||activate (open location \"spotify:search:" . $playlist . "\")|||", "Search for " . $playlist . " with Spotify", "This will start a new search in Spotify", 'fileicon:/Applications/Spotify.app', 'yes', ''); if ($is_spotifious_active == true) { $w->result('', "|||||" . "{$playlist}" . "||", "Search for " . $playlist . " with Spotifious", "Spotifious workflow must be installed", './images/spotifious.png', 'yes', ''); } } else { $currentResultNumber = 1; foreach ($json as $item) { if ($currentResultNumber > $max_results) { break; } if (strpos(strtolower($item[1]), strtolower($track)) !== false || strpos(strtolower($item[0]), strtolower($track)) !== false) { $w->result("spotify_mini-spotify-" . $playlist . "-" . $item[1], $item[2] . "|||||||", ucfirst($item[0]) . " - " . $item[1], "Play track", getTrackArtwork($item[2], true), 'yes', ''); $currentResultNumber++; } } $w->result('', "||||activate (open location \"spotify:search:" . $track . "\")|||", "Search for " . $track . " with Spotify", "This will start a new search in Spotify", 'fileicon:/Applications/Spotify.app', 'yes', ''); if ($is_spotifious_active == true) { $w->result('', "|||||" . "{$track}" . "||", "Search for " . $track . " with Spotifious", "Spotifious workflow must be installed", './images/spotifious.png', 'yes', ''); } } } } } elseif ($kind == "Settings") { // // display tracks for selected album // $max_results = $words[2];