mirror of https://github.com/arendst/Tasmota.git
post_esp32.py: Allow renaming of files from URLs on the fly (#18965)
This commit is contained in:
parent
30a65edd7a
commit
e0619c8602
|
@ -70,9 +70,12 @@ def esp32_build_filesystem(fs_size):
|
||||||
if "no_files" in file:
|
if "no_files" in file:
|
||||||
continue
|
continue
|
||||||
if "http" and "://" in file:
|
if "http" and "://" in file:
|
||||||
response = requests.get(file)
|
response = requests.get(file.split(" ")[0])
|
||||||
if response.ok:
|
if response.ok:
|
||||||
target = join(filesystem_dir,file.split(os.path.sep)[-1])
|
target = join(filesystem_dir,file.split(os.path.sep)[-1])
|
||||||
|
if len(file.split(" ")) > 1:
|
||||||
|
target = join(filesystem_dir,file.split(" ")[1])
|
||||||
|
print("Renaming",(file.split(os.path.sep)[-1]).split(" ")[0],"to",file.split(" ")[1])
|
||||||
open(target, "wb").write(response.content)
|
open(target, "wb").write(response.content)
|
||||||
else:
|
else:
|
||||||
print("Failed to download: ",file)
|
print("Failed to download: ",file)
|
||||||
|
|
Loading…
Reference in New Issue