Skip to content

Commit fb585d6

Browse files
Dean SoferDean Sofer
authored andcommitted
Try to search by title if no artist
1 parent 613a8dd commit fb585d6

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

19hz/map.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ class Events {
825825

826826
let artistsHTML = '';
827827
let spotifyPlayerHTML = '';
828+
let spotifySearchTerm = null;
828829

829830
if (hasValidArtists) {
830831
const artists = artistsInfo.split(',').map(artist => artist.trim());
@@ -838,21 +839,26 @@ class Events {
838839
return `<a href="https://open.spotify.com/search/${encodeURIComponent(artist)}" target="_blank">${artist}</a>${speakerIcon}`;
839840
}).join(', ');
840841

841-
// Create Spotify embed player placeholder
842-
spotifyPlayerHTML = `
843-
<iframe id="spotify-player"
844-
style="border-radius: 12px; margin-top: 10px;"
845-
src=""
846-
width="100%"
847-
height="152"
848-
frameBorder="0"
849-
allowfullscreen=""
850-
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
851-
loading="lazy">
852-
</iframe>
853-
`;
842+
spotifySearchTerm = firstArtist;
843+
} else {
844+
// Fall back to event title for Spotify search
845+
spotifySearchTerm = event.title;
854846
}
855847

848+
// Always create Spotify embed player placeholder
849+
spotifyPlayerHTML = `
850+
<iframe id="spotify-player"
851+
style="border-radius: 12px; margin-top: 10px;"
852+
src=""
853+
width="100%"
854+
height="152"
855+
frameBorder="0"
856+
allowfullscreen=""
857+
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
858+
loading="lazy">
859+
</iframe>
860+
`;
861+
856862
content.innerHTML = `
857863
<div class="info-header">
858864
<p><strong>Genres:</strong> ${event.categories.map(category => `<a onclick="filter({category:'${category}'})">${category}</a>`).join(', ')}</p>
@@ -866,10 +872,9 @@ class Events {
866872

867873
this.cachedInfoWindow.setContent(content);
868874

869-
// Load first artist after content is set
870-
if (hasValidArtists) {
871-
const artists = artistsInfo.split(',').map(artist => artist.trim());
872-
updateSpotifyPlayer(artists[0]);
875+
// Load Spotify player with artist name or event title
876+
if (spotifySearchTerm) {
877+
updateSpotifyPlayer(spotifySearchTerm);
873878
}
874879
}
875880
return this.cachedInfoWindow;

0 commit comments

Comments
 (0)