summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-11-09 16:14:49 +0100
committeremkael <emkael@tlen.pl>2019-11-09 16:14:49 +0100
commit21169d812779579f6a5c3b610013822bac8a9d47 (patch)
tree68ba2d25c33ad6a1af0db37348a168e1dc703c50 /scripts
parent95a8f54093e88264ebdfbbfc57d09ca6b888788b (diff)
Refactoring player generation scripts. Fixes #16
Diffstat (limited to 'scripts')
-rw-r--r--scripts/players-compile.py15
-rw-r--r--scripts/players-prepare-template.py13
2 files changed, 16 insertions, 12 deletions
diff --git a/scripts/players-compile.py b/scripts/players-compile.py
index 66750d1..4007cfa 100644
--- a/scripts/players-compile.py
+++ b/scripts/players-compile.py
@@ -1,22 +1,13 @@
-import copy, os, sys
+import os, sys
import simplejson as json
-from bs4 import BeautifulSoup as bs4
from math import ceil
from pyranking.fetch import fetch_ranking
-output_directory = sys.argv[1]
+output_directory = sys.argv[2]
pagesize = 100.0
-template = bs4(file('templates/player.html'), 'lxml')
-menu_file = sys.argv[2]
-menu_content = bs4(file(menu_file), 'html.parser')
-menu = template.select('div.static-menu')[0]
-menu.append(copy.copy(menu_content))
-
-file(os.path.join(output_directory, 'index.html'), 'w').write(template.prettify().encode('utf-8'))
-
dates = {}
-for date_config in json.load(file('config/dates.json')):
+for date_config in json.load(file(sys.argv[1])):
dates[date_config['date']] = date_config['url']
players = {}
diff --git a/scripts/players-prepare-template.py b/scripts/players-prepare-template.py
new file mode 100644
index 0000000..3d81482
--- /dev/null
+++ b/scripts/players-prepare-template.py
@@ -0,0 +1,13 @@
+import copy, os, sys
+import simplejson as json
+from bs4 import BeautifulSoup as bs4
+
+output_directory = sys.argv[1]
+
+template = bs4(file('templates/player.html'), 'lxml')
+menu_file = sys.argv[2]
+menu_content = bs4(file(menu_file), 'html.parser')
+menu = template.select('div.static-menu')[0]
+menu.append(copy.copy(menu_content))
+
+file(os.path.join(output_directory, 'index.html'), 'w').write(template.prettify().encode('utf-8'))