Fixed file not found issue in CreateSearchedLog on singles

This commit is contained in:
RemixDev 2022-01-06 14:39:20 +01:00
parent a82b674cb3
commit ba492a329b
No known key found for this signature in database
GPG key ID: B33962B465BDB51C

View file

@ -665,7 +665,10 @@ class Downloader {
try { try {
if (this.settings.logSearched && track.searched){ if (this.settings.logSearched && track.searched){
let filename = `${track.data.artist} - ${track.data.title}` let filename = `${track.data.artist} - ${track.data.title}`
let searchedFile = fs.readFileSync(`${this.downloadObject.extrasPath}/searched.txt`).toString() let searchedFile
try {
searchedFile = fs.readFileSync(`${this.downloadObject.extrasPath}/searched.txt`).toString()
} catch { searchedFile = "" }
if (searchedFile.indexOf(filename) == -1){ if (searchedFile.indexOf(filename) == -1){
if (searchedFile != "") searchedFile += "\r\n" if (searchedFile != "") searchedFile += "\r\n"
searchedFile += filename + "\r\n" searchedFile += filename + "\r\n"