Skip to content

Commit

Permalink
refined Discogs artist search to help prevent spurious matches
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Nov 14, 2023
1 parent 18caf65 commit efa0687
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/PushServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,14 @@ function($carry, $item) {
}
} else {
// advance to the first artist with artwork
//
// now that the artist search is broader, ensure at
// least a portion of the artist's name is present
// to prevent spurious hits
$afrag = substr($artist, 0, 4);
foreach($json->results as $r) {
if($r->cover_image &&
strpos($r->title, $afrag) !== false &&
!preg_match('|/spacer.gif$|', $r->cover_image)) {
$result = $r;
break;
Expand Down

0 comments on commit efa0687

Please sign in to comment.