-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[
AUTOMATE
] : Added makefile automation
- Loading branch information
1 parent
5d4ad5d
commit 3917369
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ cleaned | |
.vscode | ||
__pycache__ | ||
tmp.csv | ||
results | ||
results | ||
config/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ██████╗ ██████╗ █████╗ ██████╗ ██████╗ ███╗ ██╗███████╗██╗ ██╗██╗███████╗██╗ ██████╗ | ||
# ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗████╗ ██║██╔════╝██║ ██║██║██╔════╝██║ ██╔══██╗ | ||
# ██║ ██║██████╔╝███████║██║ ███╗██║ ██║██╔██╗ ██║███████╗███████║██║█████╗ ██║ ██║ ██║ | ||
# ██║ ██║██╔══██╗██╔══██║██║ ██║██║ ██║██║╚██╗██║╚════██║██╔══██║██║██╔══╝ ██║ ██║ ██║ | ||
# ██████╔╝██║ ██║██║ ██║╚██████╔╝╚██████╔╝██║ ╚████║███████║██║ ██║██║███████╗███████╗██████╔╝ | ||
# ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝╚═╝╚══════╝╚══════╝╚═════╝ | ||
|
||
# ██╗ ██╗████████╗██╗██╗ ██╗████████╗██╗███████╗███████╗ | ||
# ██║ ██║╚══██╔══╝██║██║ ██║╚══██╔══╝██║██╔════╝██╔════╝ | ||
# ██║ ██║ ██║ ██║██║ ██║ ██║ ██║█████╗ ███████╗ | ||
# ██║ ██║ ██║ ██║██║ ██║ ██║ ██║██╔══╝ ╚════██║ | ||
# ╚██████╔╝ ██║ ██║███████╗██║ ██║ ██║███████╗███████║ | ||
# ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ | ||
|
||
# This Makefile automate, exporteing the collection from DragonShield to Archidekt | ||
.PHONY: all export_ds convert import | ||
|
||
default: all | ||
|
||
# create a function that uses a python oneliner to access a json field | ||
fetch = python -c 'import json; print(json.load(open("$(1)"))["$(2)"])' | ||
|
||
ATTEMPTS=3 | ||
|
||
DRAGON_USER = $(shell $(call fetch,./config/config.json,dragonshield_username)) | ||
DRAGON_PASSWD = $(shell $(call fetch,./config/config.json,dragonshield_password)) | ||
|
||
ARCH_PASSWD = $(shell $(call fetch,./config/config.json,archidekt_password)) | ||
ARCH_USER = $(shell $(call fetch,./config/config.json,archidekt_username)) | ||
|
||
DLFOLDER = $(shell $(call fetch,./config/config.json,dragonshield_download_folder)) | ||
|
||
all: clean export_ds convert import | ||
|
||
export_ds: | ||
@echo "Exporting DragonShield collection to CSVs" | ||
python tools/dragonshield_scrapper.py \ | ||
-u=$(DRAGON_USER) \ | ||
-p=$(DRAGON_PASSWD) \ | ||
-a=$(ATTEMPTS) | ||
|
||
convert: input | ||
input: | ||
mkdir -p input | ||
cp $(DLFOLDER)/all-folder*.csv input/ | ||
@echo "Converting CSVs to Moxfield format" | ||
python tools/DSConvert.py \ | ||
./input | ||
|
||
import: | ||
@echo "Importing CSVs to Archidekt" | ||
python tools/archidekt_uploader.py \ | ||
./results/archidekt/ \ | ||
-u=$(ARCH_USER) \ | ||
-p=$(ARCH_PASSWD) \ | ||
-a=$(ATTEMPTS) | ||
|
||
clean: | ||
rm -rf $(DLFOLDER)/all-folder*.csv | ||
rm -rf input | ||
rm -rf results | ||
rm -rf __pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dragonshield_username" : "", | ||
"dragonshield_password" : "", | ||
"archidekt_username" : "", | ||
"archidekt_password" : "", | ||
"download_folder" : "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters