mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-06 08:25:15 -04:00
Updates the repository to download the flags from to include all flags
This commit is contained in:
parent
23e623f45c
commit
df8eb155eb
478 changed files with 19 additions and 6 deletions
|
@ -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__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue