aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTudor Roman2019-10-07 20:16:21 +0300
committerTudor Roman2019-10-07 20:16:21 +0300
commitba6c515cce83bf75081d4057b283d15ef524a3c8 (patch)
tree6096518aac4ab0a1888542207bff569aadbe7d61
parent01f0e32b1caa7ebd0b7594bb76e30dd76bf6f8d4 (diff)
downloadrmi_scripts-ba6c515cce83bf75081d4057b283d15ef524a3c8.tar.gz
rmi_scripts-ba6c515cce83bf75081d4057b283d15ef524a3c8.zip
added grab_flags: downloads flags for ranking
-rw-r--r--README.md6
-rwxr-xr-xadd_teams2
-rwxr-xr-xgrab_flags25
3 files changed, 29 insertions, 4 deletions
diff --git a/README.md b/README.md
index 2f04c5d..3db6d6f 100644
--- a/README.md
+++ b/README.md
@@ -7,8 +7,8 @@ Cuprins:
* `add_teams` - Adauga echipe
* `add_users` - Adauga concurentii in CMS
-* `add_participations` - Adauga concurentii in concurs
-* `add_external` - Genereaza useri pentru cei care dau concursul neoficial din
- exterior.
+* `add_participations` - Adauga concurentii in concurs si genereaza parole
+* `remove_participations` - Scoate concurentii din concurs
+* `grab_flags` - Descarca steaguri pentru ranking
Fiecare script vine cu instructiuni in comments.
diff --git a/add_teams b/add_teams
index 69a473c..43abcc0 100755
--- a/add_teams
+++ b/add_teams
@@ -6,7 +6,7 @@
#
# This script expects as its first argument a path to a csv file with two columns,
# name and id. name should be the long name of the team, like "Romania - Juniors",
-# while id should be an integer
+# while id should be the acronym of the team
#
import csv
diff --git a/grab_flags b/grab_flags
new file mode 100755
index 0000000..51e2df9
--- /dev/null
+++ b/grab_flags
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+#
+# Grabs flags for teams to use with Ranking Web Server
+#
+# Made by Tudor Roman, public domain
+#
+# This script expects as its first argument a path to a csv file with two columns,
+# name and id. name should be the long name of the team, like "Romania - Juniors",
+# while id should be the acronym of the team
+#
+
+import csv
+import sys
+from subprocess import call
+
+if len(sys.argv) != 2:
+ print("Usage: add_teams <csv_file>")
+ sys.exit(1)
+
+with open(sys.argv[1]) as file:
+ reader = csv.DictReader(file, delimiter=',')
+ for row in reader:
+ country = row['id'][0:2].lower()
+ call(['wget', '-O', '{}.png'.format(row['id']), 'https://github.com/hjnilsson/country-flags/raw/master/png100px/{}.png'.format(country)])
+ print(row['id'][0:2])