-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrab_flags
More file actions
executable file
·27 lines (24 loc) · 852 Bytes
/
grab_flags
File metadata and controls
executable file
·27 lines (24 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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()
if country == 'vi': # vi for vianu
continue
call(['wget', '-O', '{}.png'.format(row['id']), 'https://github.com/hjnilsson/country-flags/raw/master/png100px/{}.png'.format(country)])
print(row['id'][0:2])