allow manual track relinking

fixes #13
This commit is contained in:
Kamil
2024-11-26 15:23:08 +00:00
parent 0ca91b7d7b
commit a436a0ad91
2 changed files with 13 additions and 2 deletions

View File

@@ -84,3 +84,13 @@ function playJellyfinTrack(button, jellyfinId) {
}) })
.catch(error => console.error('Error fetching Jellyfin stream URL:', error)); .catch(error => console.error('Error fetching Jellyfin stream URL:', error));
} }
function handleJellyfinClick(event, jellyfinId, trackTitle, spotifyId) {
if (event.ctrlKey) {
// CTRL key is pressed, open the search modal
openSearchModal(trackTitle, spotifyId);
} else {
// CTRL key is not pressed, play the track
playJellyfinTrack(event.target, jellyfinId);
}
}

View File

@@ -47,13 +47,14 @@
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% set title = track.title | replace("'","") %}
{% if track.jellyfin_id %} {% if track.jellyfin_id %}
<button class="btn btn-sm btn-success" onclick="playJellyfinTrack(this, '{{ track.jellyfin_id }}')" data-bs-toggle="tooltip" title="Play from Jellyfin"> <button class="btn btn-sm btn-success" onclick="handleJellyfinClick(event, '{{ track.jellyfin_id }}', '{{ title }}', '{{ track.spotify_id }}')" data-bs-toggle="tooltip" title="Play from Jellyfin (Hold CTRL Key to reassing a new track)">
<i class="fas fa-play"></i> <i class="fas fa-play"></i>
</button> </button>
{% elif track.downloaded %} {% elif track.downloaded %}
<span data-bs-toggle="tooltip" title="Track Downloaded, but not in Jellyfin or could not be associated automatically. You can try to do the association manually"> <span data-bs-toggle="tooltip" title="Track Downloaded, but not in Jellyfin or could not be associated automatically. You can try to do the association manually">
{% set title = track.title | replace("'","") %}
<button class="btn btn-sm btn-warning" onclick="openSearchModal('{{ title }}','{{track.spotify_id}}')"> <button class="btn btn-sm btn-warning" onclick="openSearchModal('{{ title }}','{{track.spotify_id}}')">
<i class="fas fa-triangle-exclamation"></i> <i class="fas fa-triangle-exclamation"></i>
</button> </button>