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
MyCard
ygopro-cn-database-generator
Commits
7ac7f25a
Commit
7ac7f25a
authored
Jul 22, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use cnocg as a ref
parent
e899ad8e
Pipeline
#4222
passed with stages
in 1 minute and 38 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
src/cnocg.ts
src/cnocg.ts
+10
-4
src/direct.ts
src/direct.ts
+4
-1
No files found.
src/cnocg.ts
View file @
7ac7f25a
...
...
@@ -9,6 +9,11 @@ export class CNOCGFetcher extends Base {
await
fetcher
.
init
();
return
await
fetcher
.
fetch
();
}
static
async
fetchCodeOnce
()
{
const
fetcher
=
new
CNOCGFetcher
({
name
:
"
Temp NW Fetcher
"
});
await
fetcher
.
init
();
return
await
fetcher
.
fetchCode
();
}
axiosInstance
:
AxiosInstance
;
async
init
()
{
await
super
.
init
();
...
...
@@ -18,12 +23,13 @@ export class CNOCGFetcher extends Base {
})
})
}
async
fetch
():
Promise
<
Card
[]
>
{
this
.
log
.
debug
(
`Started fetching from CNOCG source...`
);
async
fetchCode
():
Promise
<
number
[]
>
{
const
allCardStrings
:
string
[]
=
(
await
this
.
axiosInstance
.
get
(
"
https://api.tcgcardgame.com/api/cards/sc
"
,
{
responseType
:
"
json
"
})).
data
;
const
allCards
=
allCardStrings
.
map
(
m
=>
new
Card
(
parseInt
(
m
)));
return
allCards
;
return
allCardStrings
.
map
(
m
=>
parseInt
(
m
));
}
async
fetch
():
Promise
<
Card
[]
>
{
return
(
await
this
.
fetchCode
()).
map
(
m
=>
new
Card
(
m
));
}
}
src/direct.ts
View file @
7ac7f25a
import
Base
from
"
./base
"
;
import
{
promises
as
fs
}
from
"
fs
"
;
import
{
Card
}
from
"
./dbreader
"
;
import
{
CNOCGFetcher
}
from
"
./cnocg
"
;
export
class
DirectFetcher
extends
Base
{
static
async
fetchOnce
()
{
const
fetcher
=
new
DirectFetcher
({
name
:
"
Temp Direct Fetcher
"
,
level
:
'
debug
'
});
const
fetcher
=
new
DirectFetcher
({
name
:
"
Temp Direct Fetcher
"
,
level
:
'
info
'
});
await
fetcher
.
init
();
return
await
fetcher
.
fetch
();
}
...
...
@@ -53,6 +54,8 @@ export class DirectFetcher extends Base {
}
}
async
fetch
():
Promise
<
Card
[]
>
{
this
.
log
.
info
(
`Started fetching from CNOCG.`
);
this
.
cardCodes
=
await
CNOCGFetcher
.
fetchCodeOnce
();
this
.
log
.
info
(
`Started reading from ydk cards.`
);
const
ydkFiles
=
await
fs
.
readdir
(
'
./packs
'
);
this
.
log
.
info
(
`
${
ydkFiles
.
length
}
packs found.`
);
...
...
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