wip implementation of local library on anime
This commit is contained in:
@@ -2,7 +2,7 @@ const sqlite3 = require('sqlite3').verbose();
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const {ensureUserDataDB, ensureAnilistSchema, ensureExtensionsTable, ensureCacheTable, ensureFavoritesDB} = require('./schemas');
|
||||
const {ensureUserDataDB, ensureAnilistSchema, ensureExtensionsTable, ensureCacheTable, ensureFavoritesDB, ensureLocalLibrarySchema } = require('./schemas');
|
||||
|
||||
const databases = new Map();
|
||||
|
||||
@@ -10,7 +10,8 @@ const DEFAULT_PATHS = {
|
||||
anilist: path.join(os.homedir(), "WaifuBoards", 'anilist_anime.db'),
|
||||
favorites: path.join(os.homedir(), "WaifuBoards", "favorites.db"),
|
||||
cache: path.join(os.homedir(), "WaifuBoards", "cache.db"),
|
||||
userdata: path.join(os.homedir(), "WaifuBoards", "user_data.db")
|
||||
userdata: path.join(os.homedir(), "WaifuBoards", "user_data.db"),
|
||||
local_library: path.join(os.homedir(), "WaifuBoards", "local_library.db")
|
||||
};
|
||||
|
||||
function initDatabase(name = 'anilist', dbPath = null, readOnly = false) {
|
||||
@@ -49,6 +50,11 @@ function initDatabase(name = 'anilist', dbPath = null, readOnly = false) {
|
||||
|
||||
databases.set(name, db);
|
||||
|
||||
if (name === "local_library") {
|
||||
ensureLocalLibrarySchema(db)
|
||||
.catch(err => console.error("Error creating local library schema:", err));
|
||||
}
|
||||
|
||||
if (name === "anilist") {
|
||||
ensureAnilistSchema(db)
|
||||
.then(() => ensureExtensionsTable(db))
|
||||
|
||||
Reference in New Issue
Block a user