Commit 93f4ce5c authored by nanahira's avatar nanahira

refa

parent 5a4ece2b
......@@ -115,3 +115,4 @@ Dockerfile
/ygopro-*
/pack.db
/mats
......@@ -110,3 +110,4 @@ dist
/ygopro-*
/pack.db
/lflist.conf
/mats
......@@ -47,7 +47,9 @@ npm_ci:
NPM_SCRIPT: start
CARD_SYMBOL: '简体中文卡'
FILE_SYMBOL: 'cn'
script: ./ci-scripts/generate.sh
script:
- apt update ; apt -y install sqlite3
- ./ci-scripts/generate.sh
artifacts:
paths:
- output
......
......@@ -8,7 +8,7 @@ export LFLIST_PATH="./mats/lflist.conf"
export CARD_LIST_DATABASE_PATH="./mats/pack.db"
export OUTPUT_PATH="./output/$FILE_SYMBOL-$LOCALE"
apt update ; apt -y install sqlite3
# apt update ; apt -y install sqlite3
npm run "$NPM_SCRIPT"
......
......@@ -266,4 +266,16 @@ export class DBReader extends Base {
await this.generateDecks(cards);
this.log.info(`Decks generated.`);
}
async getAllCardsFromDatabase(dbPath: string) {
try {
const db = await this.openDatabase(dbPath);
const codes: number[] = (await db.all('SELECT id FROM datas where type & 0x4000 = 0 and not exists (select 1 from datas orig where orig.id = datas.alias and orig.id < datas.id and orig.id >= (datas.id - 20))')).map(m => m.id);
await db.close();
return codes;
} catch (e) {
this.log.error(`Error getting all cards from database: ${e}`);
return [];
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment