blank show.json creation if not present

This commit is contained in:
Karl0ss 2023-06-07 14:43:30 +01:00
parent dfa7194f33
commit 2d3ae87492

View File

@ -40,9 +40,19 @@ function create_empty_retry_cache() {
} }
} }
function create_empty_shows_file() {
try {
return JSON.parse(fs.readFileSync('./shows.json'));
} catch (error) {
fs.writeFileSync('./shows.json', JSON.stringify([]));
return JSON.parse(fs.readFileSync('./shows.json'));
}
}
function create_empty_cache_files() { function create_empty_cache_files() {
create_empty_downloadHistory() create_empty_downloadHistory()
create_empty_retry_cache() create_empty_retry_cache()
create_empty_shows_file()
} }
module.exports = { module.exports = {