diff options
author | Saptak S <saptak013@gmail.com> | 2022-03-17 00:03:51 +0530 |
---|---|---|
committer | Saptak S <saptak013@gmail.com> | 2022-03-31 18:20:29 +0530 |
commit | df8eb155eb34e59c79fdebfaa418800a357103a9 (patch) | |
tree | 30ee9aaac33fd74ab66d03e06dfeaab0852fb2ab /desktop/scripts | |
parent | 23e623f45c246106cec084c90ac946a4e9c03f79 (diff) | |
download | onionshare-df8eb155eb34e59c79fdebfaa418800a357103a9.tar.gz onionshare-df8eb155eb34e59c79fdebfaa418800a357103a9.zip |
Updates the repository to download the flags from to include all flags
Diffstat (limited to 'desktop/scripts')
-rw-r--r-- | desktop/scripts/countries-get-flag.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/desktop/scripts/countries-get-flag.py b/desktop/scripts/countries-get-flag.py index 608595a3..e500fd00 100644 --- a/desktop/scripts/countries-get-flag.py +++ b/desktop/scripts/countries-get-flag.py @@ -8,7 +8,7 @@ import os def main(): tmp_dir = tempfile.TemporaryDirectory() flagsdir = os.path.join(tmp_dir.name, "flagsicon") - subprocess.run(["git", "clone", "https://github.com/gosquared/flags.git", flagsdir]) + subprocess.run(["git", "clone", "https://github.com/lipis/flag-icons.git", flagsdir]) with open( os.path.join("onionshare", "resources", "countries", "en.json") @@ -26,8 +26,9 @@ def main(): ) for country in countries: - if os.path.isfile(os.path.join(flagsdir, "flags", "flags-iso", "flat", "64", f"{country}.png")): - src_filename = os.path.join(flagsdir, "flags", "flags-iso", "flat", "64", f"{country}.png") + country = country.lower() + if os.path.isfile(os.path.join(flagsdir, "flags", "4x3", f"{country}.svg")): + src_filename = os.path.join(flagsdir, "flags", "4x3", f"{country}.svg") dest_filename = os.path.join( "onionshare", "resources", @@ -35,7 +36,19 @@ def main(): "countries", f"{country}.png", ) - subprocess.run(["cp", src_filename, dest_filename]) + subprocess.run( + [ + "convert", + src_filename, + "-background", + "none", + "-density", + "100", + "-resize", + "64x", + dest_filename, + ] + ) if __name__ == "__main__": |