diff options
author | Tudor Roman | 2019-10-07 20:16:21 +0300 |
---|---|---|
committer | Tudor Roman | 2019-10-07 20:16:21 +0300 |
commit | ba6c515cce83bf75081d4057b283d15ef524a3c8 (patch) | |
tree | 6096518aac4ab0a1888542207bff569aadbe7d61 | |
parent | 01f0e32b1caa7ebd0b7594bb76e30dd76bf6f8d4 (diff) | |
download | rmi_scripts-ba6c515cce83bf75081d4057b283d15ef524a3c8.tar.gz rmi_scripts-ba6c515cce83bf75081d4057b283d15ef524a3c8.zip |
added grab_flags: downloads flags for ranking
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | add_teams | 2 | ||||
-rwxr-xr-x | grab_flags | 25 |
3 files changed, 29 insertions, 4 deletions
@@ -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. @@ -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]) |