style: auto-fix linting issues
This commit is contained in:
parent
1cac6d249b
commit
5663b841c9
2 changed files with 63 additions and 23 deletions
54
index.html
54
index.html
|
|
@ -568,31 +568,63 @@
|
|||
|
||||
<div id="csv-import-panel" class="import-panel active">
|
||||
<p style="margin-bottom: 0.5rem; font-size: 0.9rem">Import from CSV</p>
|
||||
|
||||
|
||||
<div style="display: flex; gap: 0.5rem; margin-bottom: 1rem">
|
||||
<button type="button" id="csv-spotify-btn" class="btn-secondary" style="flex: 1; opacity: 0.7">Spotify</button>
|
||||
<button type="button" id="csv-apple-btn" class="btn-secondary" style="flex: 1; opacity: 0.7">Apple Music</button>
|
||||
<button type="button" id="csv-ytm-btn" class="btn-secondary" style="flex: 1; opacity: 0.7">YouTube Music</button>
|
||||
<button
|
||||
type="button"
|
||||
id="csv-spotify-btn"
|
||||
class="btn-secondary"
|
||||
style="flex: 1; opacity: 0.7"
|
||||
>
|
||||
Spotify
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
id="csv-apple-btn"
|
||||
class="btn-secondary"
|
||||
style="flex: 1; opacity: 0.7"
|
||||
>
|
||||
Apple Music
|
||||
</button>
|
||||
<button type="button" id="csv-ytm-btn" class="btn-secondary" style="flex: 1; opacity: 0.7">
|
||||
YouTube Music
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="csv-spotify-guide" style="display: none; margin-bottom: 1rem">
|
||||
<p style="font-size: 0.8rem; margin: 0">
|
||||
Please use <a href="https://exportify.app/" target="_blank" style="text-decoration: underline">Exportify</a> to export your Spotify playlist into a .csv.
|
||||
Please use
|
||||
<a href="https://exportify.app/" target="_blank" style="text-decoration: underline"
|
||||
>Exportify</a
|
||||
>
|
||||
to export your Spotify playlist into a .csv.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="csv-apple-guide" style="display: none; margin-bottom: 1rem">
|
||||
<p style="font-size: 0.8rem; margin: 0">
|
||||
Please use <a href="https://www.tunemymusic.com/transfer/spotify-to-apple-music" target="_blank" style="text-decoration: underline">TuneMyMusic</a> to export your Apple Music playlist into a .csv.
|
||||
<br><span style="opacity: 0.7">(Apple Music imports are prone to errors)</span>
|
||||
Please use
|
||||
<a
|
||||
href="https://www.tunemymusic.com/transfer/spotify-to-apple-music"
|
||||
target="_blank"
|
||||
style="text-decoration: underline"
|
||||
>TuneMyMusic</a
|
||||
>
|
||||
to export your Apple Music playlist into a .csv. <br /><span style="opacity: 0.7"
|
||||
>(Apple Music imports are prone to errors)</span
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="csv-ytm-guide" style="display: none; margin-bottom: 1rem">
|
||||
<p style="font-size: 0.8rem; margin: 0 0 0.5rem 0">
|
||||
Paste a YouTube Music Playlist URL.
|
||||
</p>
|
||||
<input type="text" id="ytm-url-input" class="template-input" placeholder="https://music.youtube.com/playlist?list=..." style="width: 100%; margin-bottom: 0.5rem">
|
||||
<p style="font-size: 0.8rem; margin: 0 0 0.5rem 0">Paste a YouTube Music Playlist URL.</p>
|
||||
<input
|
||||
type="text"
|
||||
id="ytm-url-input"
|
||||
class="template-input"
|
||||
placeholder="https://music.youtube.com/playlist?list=..."
|
||||
style="width: 100%; margin-bottom: 0.5rem"
|
||||
/>
|
||||
<p id="ytm-status" style="font-size: 0.8rem; margin: 0; opacity: 0.7"></p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
32
js/app.js
32
js/app.js
|
|
@ -565,7 +565,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
appleBtn.classList.remove('btn-primary');
|
||||
appleBtn.classList.add('btn-secondary');
|
||||
appleBtn.style.opacity = '0.7';
|
||||
|
||||
|
||||
ytmBtn.classList.remove('btn-primary');
|
||||
ytmBtn.classList.add('btn-secondary');
|
||||
ytmBtn.style.opacity = '0.7';
|
||||
|
|
@ -584,7 +584,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
spotifyBtn.classList.remove('btn-primary');
|
||||
spotifyBtn.classList.add('btn-secondary');
|
||||
spotifyBtn.style.opacity = '0.7';
|
||||
|
||||
|
||||
ytmBtn.classList.remove('btn-primary');
|
||||
ytmBtn.classList.add('btn-secondary');
|
||||
ytmBtn.style.opacity = '0.7';
|
||||
|
|
@ -1073,7 +1073,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
importSource = 'ytm_import';
|
||||
const url = ytmUrlInput.value.trim();
|
||||
const playlistId = url.split('list=')[1]?.split('&')[0];
|
||||
|
||||
|
||||
const workerUrl = `https://ytmimport.samidy.workers.dev?playlistId=${playlistId}`;
|
||||
|
||||
if (!playlistId) {
|
||||
|
|
@ -1104,10 +1104,15 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
|
||||
currentTrackElement.textContent = `Processing ${songs.length} songs...`;
|
||||
|
||||
const headers = "Title,Artist,URL\n";
|
||||
const csvText = headers + songs.map(s =>
|
||||
`"${s.title.replace(/"/g, '""')}","${s.artist.replace(/"/g, '""')}","${s.url}"`
|
||||
).join("\n");
|
||||
const headers = 'Title,Artist,URL\n';
|
||||
const csvText =
|
||||
headers +
|
||||
songs
|
||||
.map(
|
||||
(s) =>
|
||||
`"${s.title.replace(/"/g, '""')}","${s.artist.replace(/"/g, '""')}","${s.url}"`
|
||||
)
|
||||
.join('\n');
|
||||
|
||||
const totalTracks = songs.length;
|
||||
progressTotal.textContent = totalTracks.toString();
|
||||
|
|
@ -1123,7 +1128,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
|
||||
tracks = result.tracks;
|
||||
const missingTracks = result.missingTracks;
|
||||
|
||||
|
||||
if (tracks.length === 0) {
|
||||
alert('No valid tracks found in the YouTube playlist!');
|
||||
progressElement.style.display = 'none';
|
||||
|
|
@ -2291,10 +2296,13 @@ function showMissingTracksNotification(missingTracks) {
|
|||
const modal = document.getElementById('missing-tracks-modal');
|
||||
const listUl = document.getElementById('missing-tracks-list-ul');
|
||||
|
||||
listUl.innerHTML = missingTracks.map((track) => {
|
||||
const text = typeof track === 'string' ? track : `${track.artist ? track.artist + ' - ' : ''}${track.title}`;
|
||||
return `<li>${text}</li>`;
|
||||
}).join('');
|
||||
listUl.innerHTML = missingTracks
|
||||
.map((track) => {
|
||||
const text =
|
||||
typeof track === 'string' ? track : `${track.artist ? track.artist + ' - ' : ''}${track.title}`;
|
||||
return `<li>${text}</li>`;
|
||||
})
|
||||
.join('');
|
||||
|
||||
const closeModal = () => modal.classList.remove('active');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue