From 55eb1c76c5c03b27e3585097cd4c530498311900 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Thu, 14 Nov 2019 19:08:48 +0200 Subject: [PATCH] quick fix --- src/common/download.js | 3 +-- src/lastfm.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/download.js b/src/common/download.js index 1cde48e..3d25e70 100644 --- a/src/common/download.js +++ b/src/common/download.js @@ -48,8 +48,7 @@ function getVideoInfo (arg) { return new Promise((resolve, reject) => { yt.on('close', function () { - let ftdata = output.split('\n') - console.log(ftdata.length) + let ftdata = output.trim().split('\n') if (ftdata.length > 1) { let composite = [] for (let i in ftdata) { diff --git a/src/lastfm.js b/src/lastfm.js index eed1602..15d568e 100644 --- a/src/lastfm.js +++ b/src/lastfm.js @@ -67,7 +67,7 @@ async function getTrackMetaReal (id) { candidates.push(obj) } - if (candidates.length) { + if (candidates.length && !bestMatch) { // Sort candidates by view count candidates = candidates.sort(function (a, b) { return b.view_count - a.view_count @@ -78,7 +78,7 @@ async function getTrackMetaReal (id) { } // If there were no suitable candidates, just take the first response - if (!candidates.length) bestMatch = dldata[0] + if (!candidates.length && !bestMatch) bestMatch = dldata[0] externalTracks[id] = { id: trdata.id,