Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-cn-database-generator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
301zrg
ygopro-cn-database-generator
Commits
a8395c87
Commit
a8395c87
authored
Oct 26, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add includes.cdb and excludes.cdb
parent
93f4ce5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
src/dbreader.ts
src/dbreader.ts
+1
-0
subenv.ts
subenv.ts
+24
-5
No files found.
src/dbreader.ts
View file @
a8395c87
...
@@ -116,6 +116,7 @@ export class DBReader extends Base {
...
@@ -116,6 +116,7 @@ export class DBReader extends Base {
outputdb
:
Database
;
outputdb
:
Database
;
overrideTextDb
:
Database
;
overrideTextDb
:
Database
;
async
openDatabase
(
path
:
string
)
{
async
openDatabase
(
path
:
string
)
{
await
fs
.
access
(
path
);
return
await
open
({
return
await
open
({
filename
:
path
,
filename
:
path
,
driver
:
sqlite3
.
Database
driver
:
sqlite3
.
Database
...
...
subenv.ts
View file @
a8395c87
...
@@ -7,8 +7,15 @@ import fs from 'fs';
...
@@ -7,8 +7,15 @@ import fs from 'fs';
const
DATE
=
process
.
env
.
DATE
;
const
DATE
=
process
.
env
.
DATE
;
const
lflistPath
=
process
.
env
.
LFLIST_PATH
||
"
./lflist.conf
"
;
const
lflistPath
=
process
.
env
.
LFLIST_PATH
||
"
./lflist.conf
"
;
const
includes
=
(
process
.
env
.
INCLUDES
||
""
).
split
(
"
,
"
).
filter
(
i
=>
i
).
map
(
i
=>
parseInt
(
i
.
trim
()));
const
excludes
=
new
Set
((
process
.
env
.
EXCLUDES
||
""
).
split
(
"
,
"
).
filter
(
i
=>
i
).
map
(
i
=>
parseInt
(
i
.
trim
())));
const
parseEnvList
=
(
envVar
:
string
):
number
[]
=>
{
return
(
process
.
env
[
envVar
]
||
""
).
split
(
"
,
"
).
filter
(
i
=>
i
).
map
(
i
=>
parseInt
(
i
.
trim
()));
}
const
includes
=
parseEnvList
(
"
INCLUDES
"
);
const
excludes
=
parseEnvList
(
"
EXCLUDES
"
);
const
fileSymbol
=
process
.
env
.
FILE_SYMBOL
||
"
cn
"
;
async
function
getBanlist
()
{
async
function
getBanlist
()
{
const
lflistData
=
await
fs
.
promises
.
readFile
(
lflistPath
,
'
utf-8
'
);
const
lflistData
=
await
fs
.
promises
.
readFile
(
lflistPath
,
'
utf-8
'
);
...
@@ -17,7 +24,7 @@ async function getBanlist() {
...
@@ -17,7 +24,7 @@ async function getBanlist() {
date
:
moment
(
l
.
name
.
split
(
'
'
)[
0
],
'
YYYY.MM
'
)
date
:
moment
(
l
.
name
.
split
(
'
'
)[
0
],
'
YYYY.MM
'
)
})).
filter
(
l
=>
l
.
date
.
isBefore
(
DATE
));
})).
filter
(
l
=>
l
.
date
.
isBefore
(
DATE
));
const
lflist
=
_
.
maxBy
(
lflists
,
l
=>
l
.
date
.
unix
());
const
lflist
=
_
.
maxBy
(
lflists
,
l
=>
l
.
date
.
unix
());
const
extraLflistPath
=
`./extras/
${
process
.
env
.
FILE_SYMBOL
}
/lflist.conf`
;
const
extraLflistPath
=
`./extras/
${
fileSymbol
}
/lflist.conf`
;
let
extraLflist
:
Banlist
;
let
extraLflist
:
Banlist
;
try
{
try
{
const
extraLflistContent
=
await
fs
.
promises
.
readFile
(
extraLflistPath
,
'
utf-8
'
);
const
extraLflistContent
=
await
fs
.
promises
.
readFile
(
extraLflistPath
,
'
utf-8
'
);
...
@@ -32,15 +39,27 @@ async function main() {
...
@@ -32,15 +39,27 @@ async function main() {
//level: Logger.DEBUG
//level: Logger.DEBUG
});
});
await
dbreader
.
init
();
await
dbreader
.
init
();
const
readDbAndInject
=
async
(
dbPath
:
string
,
target
:
number
[])
=>
{
const
codes
=
await
dbreader
.
getAllCardsFromDatabase
(
dbPath
);
target
.
push
(...
codes
);
}
await
Promise
.
all
([
readDbAndInject
(
`./extras/
${
fileSymbol
}
/includes.cdb`
,
includes
),
readDbAndInject
(
`./extras/
${
fileSymbol
}
/excludes.cdb`
,
excludes
),
])
const
excludesSet
=
new
Set
(
excludes
);
const
cards
=
(
await
PackDbFetcher
.
fetchOnce
(
dbreader
,
`date <= '
${
DATE
}
'`
))
const
cards
=
(
await
PackDbFetcher
.
fetchOnce
(
dbreader
,
`date <= '
${
DATE
}
'`
))
.
filter
(
c
=>
!
excludes
.
has
(
c
.
code
));
.
filter
(
c
=>
!
excludes
Set
.
has
(
c
.
code
));
const
existingIds
=
new
Set
(
cards
.
map
(
c
=>
c
.
code
));
const
existingIds
=
new
Set
(
cards
.
map
(
c
=>
c
.
code
));
for
(
const
include
of
includes
)
{
for
(
const
include
of
includes
)
{
if
(
!
existingIds
.
has
(
include
))
{
if
(
!
existingIds
.
has
(
include
))
{
cards
.
push
(
new
Card
(
include
));
cards
.
push
(
new
Card
(
include
));
}
}
}
}
console
.
log
(
cards
.
length
);
console
.
log
(
`Total cards to process:
${
cards
.
length
}
`
);
const
extraBanlist
=
await
getBanlist
();
const
extraBanlist
=
await
getBanlist
();
await
dbreader
.
run
(
cards
,
{
await
dbreader
.
run
(
cards
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment