style: auto-fix linting issues
This commit is contained in:
parent
46c565e437
commit
0735d2a202
3 changed files with 73 additions and 39 deletions
30
index.html
30
index.html
|
|
@ -1649,11 +1649,17 @@
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<h3 style="text-align: center; margin-bottom: 1rem">Support Monochrome</h3>
|
<h3 style="text-align: center; margin-bottom: 1rem">Support Monochrome</h3>
|
||||||
<p style="text-align: center; margin-bottom: 1.5rem; line-height: 1.6; color: var(--muted-foreground)">
|
<p style="text-align: center; margin-bottom: 1.5rem; line-height: 1.6; color: var(--muted-foreground)">
|
||||||
If Monochrome has been useful to you and you're able to, consider making a donation. It helps pay for
|
If Monochrome has been useful to you and you're able to, consider making a donation. It helps pay
|
||||||
the server and domain, and you get to support us :)
|
for the server and domain, and you get to support us :)
|
||||||
</p>
|
</p>
|
||||||
<div style="display: flex; justify-content: center; margin-bottom: 2rem">
|
<div style="display: flex; justify-content: center; margin-bottom: 2rem">
|
||||||
<a href="https://ko-fi.com/monochromemusic" target="_blank" rel="noopener noreferrer" class="btn-primary" style="text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem">
|
<a
|
||||||
|
href="https://ko-fi.com/monochromemusic"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
class="btn-primary"
|
||||||
|
style="text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem"
|
||||||
|
>
|
||||||
Donate on Ko-fi
|
Donate on Ko-fi
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1661,7 +1667,19 @@
|
||||||
<p style="font-size: 0.9rem; color: var(--muted-foreground); margin-bottom: 0.5rem">
|
<p style="font-size: 0.9rem; color: var(--muted-foreground); margin-bottom: 0.5rem">
|
||||||
An alternative way to support us is by starring us on GitHub, and it's completely free!
|
An alternative way to support us is by starring us on GitHub, and it's completely free!
|
||||||
</p>
|
</p>
|
||||||
<a href="https://github.com/monochrome-music/monochrome" target="_blank" rel="noopener noreferrer" class="btn-secondary" style="text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem">
|
<a
|
||||||
|
href="https://github.com/monochrome-music/monochrome"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
class="btn-secondary"
|
||||||
|
style="
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
"
|
||||||
|
>
|
||||||
Star on GitHub
|
Star on GitHub
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -5180,7 +5198,9 @@
|
||||||
It helps pay for the server and domain, and you get to support us :)
|
It helps pay for the server and domain, and you get to support us :)
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
class="donate-button" id="donate-button-container" style="
|
class="donate-button"
|
||||||
|
id="donate-button-container"
|
||||||
|
style="
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
52
js/app.js
52
js/app.js
|
|
@ -1210,14 +1210,19 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const totalTracks = songs.length;
|
const totalTracks = songs.length;
|
||||||
progressTotal.textContent = totalTracks.toString();
|
progressTotal.textContent = totalTracks.toString();
|
||||||
|
|
||||||
const result = await parseCSV(csvText, api, (progress) => {
|
const result = await parseCSV(
|
||||||
const percentage = totalTracks > 0 ? (progress.current / totalTracks) * 100 : 0;
|
csvText,
|
||||||
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
api,
|
||||||
progressCurrent.textContent = progress.current.toString();
|
(progress) => {
|
||||||
currentTrackElement.textContent = progress.currentTrack;
|
const percentage = totalTracks > 0 ? (progress.current / totalTracks) * 100 : 0;
|
||||||
if (currentArtistElement)
|
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
||||||
currentArtistElement.textContent = progress.currentArtist || '';
|
progressCurrent.textContent = progress.current.toString();
|
||||||
}, importOptions);
|
currentTrackElement.textContent = progress.currentTrack;
|
||||||
|
if (currentArtistElement)
|
||||||
|
currentArtistElement.textContent = progress.currentArtist || '';
|
||||||
|
},
|
||||||
|
importOptions
|
||||||
|
);
|
||||||
|
|
||||||
tracks = result.tracks;
|
tracks = result.tracks;
|
||||||
const missingTracks = result.missingTracks;
|
const missingTracks = result.missingTracks;
|
||||||
|
|
@ -1354,17 +1359,22 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const totalItems = Math.max(0, lines.length - 1);
|
const totalItems = Math.max(0, lines.length - 1);
|
||||||
progressTotal.textContent = totalItems.toString();
|
progressTotal.textContent = totalItems.toString();
|
||||||
|
|
||||||
const result = await parseDynamicCSV(csvText, api, (progress) => {
|
const result = await parseDynamicCSV(
|
||||||
const percentage = totalItems > 0 ? (progress.current / totalItems) * 100 : 0;
|
csvText,
|
||||||
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
api,
|
||||||
progressCurrent.textContent = progress.current.toString();
|
(progress) => {
|
||||||
currentTrackElement.textContent = progress.currentItem;
|
const percentage = totalItems > 0 ? (progress.current / totalItems) * 100 : 0;
|
||||||
if (currentArtistElement) {
|
progressFill.style.width = `${Math.min(percentage, 100)}%`;
|
||||||
currentArtistElement.textContent = progress.type
|
progressCurrent.textContent = progress.current.toString();
|
||||||
? `Importing ${progress.type}...`
|
currentTrackElement.textContent = progress.currentItem;
|
||||||
: '';
|
if (currentArtistElement) {
|
||||||
}
|
currentArtistElement.textContent = progress.type
|
||||||
}, importOptions);
|
? `Importing ${progress.type}...`
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
importOptions
|
||||||
|
);
|
||||||
|
|
||||||
const hasMultipleTypes =
|
const hasMultipleTypes =
|
||||||
result.tracks.length > 0 && (result.albums.length > 0 || result.artists.length > 0);
|
result.tracks.length > 0 && (result.albums.length > 0 || result.artists.length > 0);
|
||||||
|
|
@ -2606,7 +2616,9 @@ function showMissingTracksNotification(missingTracks) {
|
||||||
newCopyBtn.addEventListener('click', () => {
|
newCopyBtn.addEventListener('click', () => {
|
||||||
const textToCopy = missingTracks
|
const textToCopy = missingTracks
|
||||||
.map((track) => {
|
.map((track) => {
|
||||||
return typeof track === 'string' ? track : `${track.artist ? track.artist + ' - ' : ''}${track.title}`;
|
return typeof track === 'string'
|
||||||
|
? track
|
||||||
|
: `${track.artist ? track.artist + ' - ' : ''}${track.title}`;
|
||||||
})
|
})
|
||||||
.join('\n');
|
.join('\n');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,24 @@ function findBestMatch(items, targetArtist, targetAlbum, options) {
|
||||||
if (!items || items.length === 0) return null;
|
if (!items || items.length === 0) return null;
|
||||||
if (!options?.strictArtistMatch && !options?.albumMatch) return items[0];
|
if (!options?.strictArtistMatch && !options?.albumMatch) return items[0];
|
||||||
|
|
||||||
return items.find((item) => {
|
return (
|
||||||
let artistOk = true;
|
items.find((item) => {
|
||||||
let albumOk = true;
|
let artistOk = true;
|
||||||
|
let albumOk = true;
|
||||||
|
|
||||||
if (options.strictArtistMatch && targetArtist) {
|
if (options.strictArtistMatch && targetArtist) {
|
||||||
const itemArtist = item.artist?.name || item.artists?.[0]?.name;
|
const itemArtist = item.artist?.name || item.artists?.[0]?.name;
|
||||||
if (!isFuzzyMatch(itemArtist, targetArtist)) artistOk = false;
|
if (!isFuzzyMatch(itemArtist, targetArtist)) artistOk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.albumMatch && targetAlbum) {
|
if (options.albumMatch && targetAlbum) {
|
||||||
const itemAlbum = item.album?.title;
|
const itemAlbum = item.album?.title;
|
||||||
if (itemAlbum && !isFuzzyMatch(itemAlbum, targetAlbum)) albumOk = false;
|
if (itemAlbum && !isFuzzyMatch(itemAlbum, targetAlbum)) albumOk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return artistOk && albumOk;
|
return artistOk && albumOk;
|
||||||
}) || null;
|
}) || null
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue