Commit 93f4ce5c authored by nanahira's avatar nanahira

refa

parent 5a4ece2b
...@@ -115,3 +115,4 @@ Dockerfile ...@@ -115,3 +115,4 @@ Dockerfile
/ygopro-* /ygopro-*
/pack.db /pack.db
/mats
...@@ -110,3 +110,4 @@ dist ...@@ -110,3 +110,4 @@ dist
/ygopro-* /ygopro-*
/pack.db /pack.db
/lflist.conf /lflist.conf
/mats
...@@ -47,7 +47,9 @@ npm_ci: ...@@ -47,7 +47,9 @@ npm_ci:
NPM_SCRIPT: start NPM_SCRIPT: start
CARD_SYMBOL: '简体中文卡' CARD_SYMBOL: '简体中文卡'
FILE_SYMBOL: 'cn' FILE_SYMBOL: 'cn'
script: ./ci-scripts/generate.sh script:
- apt update ; apt -y install sqlite3
- ./ci-scripts/generate.sh
artifacts: artifacts:
paths: paths:
- output - output
......
...@@ -8,7 +8,7 @@ export LFLIST_PATH="./mats/lflist.conf" ...@@ -8,7 +8,7 @@ export LFLIST_PATH="./mats/lflist.conf"
export CARD_LIST_DATABASE_PATH="./mats/pack.db" export CARD_LIST_DATABASE_PATH="./mats/pack.db"
export OUTPUT_PATH="./output/$FILE_SYMBOL-$LOCALE" export OUTPUT_PATH="./output/$FILE_SYMBOL-$LOCALE"
apt update ; apt -y install sqlite3 # apt update ; apt -y install sqlite3
npm run "$NPM_SCRIPT" npm run "$NPM_SCRIPT"
......
...@@ -266,4 +266,16 @@ export class DBReader extends Base { ...@@ -266,4 +266,16 @@ export class DBReader extends Base {
await this.generateDecks(cards); await this.generateDecks(cards);
this.log.info(`Decks generated.`); 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