Create custom comparison function

This commit is contained in:
MeowcaTheoRange 2024-02-23 18:35:33 -06:00
parent dafa8087ec
commit a2ce16a2c3

View file

@ -11,6 +11,10 @@ const io = require('socket.io-client');
const NodeID3 = require('node-id3');
const { JSDOM } = require("jsdom");
function compareCase(string) {
return string.toLowerCase().replace(/\w/gm, "");
}
function pathGenerator({ url, name, channelName }) {
return `${url}-${skewered(`${name} - ${channelName}`)}.mp3`;
}
@ -90,8 +94,8 @@ async function getVideo() {
const musicList = await searchMusics(`${trackData.artist.name} - ${trackData.name}`);
const youtubeMusicVideo = musicList.find((song) => {
return skewered(song.title).includes(skewered(trackData.name))
&& song.artists.some(artist => skewered(trackData.artist.name).includes(skewered(artist.name)));
return compareCase(song.title).includes(compareCase(trackData.name))
&& song.artists.some(artist => compareCase(trackData.artist.name).includes(compareCase(artist.name)));
});
if (youtubeMusicVideo == null) {