fix: bugs

fix: bugs
This commit is contained in:
qier222 2022-04-09 00:28:37 +08:00
parent 1444bbefa2
commit 70d1de0e0f
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
62 changed files with 368 additions and 284 deletions

View file

@ -1,5 +1,5 @@
import path from 'path'
import { app, ipcMain } from 'electron'
import { app } from 'electron'
import fs from 'fs'
import SQLite3 from 'better-sqlite3'
import logger from './logger'
@ -113,30 +113,4 @@ export const db = {
},
}
// 导出tables到json文件方便查看table大小
if (process.env.NODE_ENV === 'development') {
ipcMain.on('db-export-json', () => {
const tables = [
Tables.ARTIST_ALBUMS,
Tables.PLAYLIST,
Tables.ALBUM,
Tables.TRACK,
Tables.ARTIST,
Tables.AUDIO,
Tables.ACCOUNT_DATA,
Tables.LYRIC,
]
tables.forEach(table => {
const data = db.findAll(table)
fs.writeFile(`./tmp/${table}.json`, JSON.stringify(data), function (err) {
if (err) {
return console.log(err)
}
console.log('The file was saved!')
})
})
})
}
logger.info('[db] Database initialized')