mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[scripts/wastickers] Fixed paths and enabled compression
This commit is contained in:
parent
1675c8174a
commit
6715440edc
1 changed files with 4 additions and 3 deletions
|
@ -5,7 +5,7 @@ import subprocess
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import time
|
import time
|
||||||
import pathlib
|
import pathlib
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile, ZIP_STORED
|
||||||
|
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
pathlib.Path(f'./tmp').mkdir(parents=True, exist_ok=True)
|
pathlib.Path(f'./tmp').mkdir(parents=True, exist_ok=True)
|
||||||
|
@ -45,10 +45,11 @@ for file in files:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
files = glob('./*')
|
files = glob('./*')
|
||||||
with ZipFile(f'{pname}.wastickers', 'w') as zip:
|
with ZipFile(f'{pname}.wastickers', 'w', ZIP_STORED) as zip:
|
||||||
for file in files:
|
for file in files:
|
||||||
|
zipfilename = file.replace('./', '/')
|
||||||
with open(file, 'rb') as image_file:
|
with open(file, 'rb') as image_file:
|
||||||
zip.writestr(f"/{file}", image_file.read())
|
zip.writestr(f"{zipfilename}", image_file.read())
|
||||||
|
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
copyfile(f'./tmp/{pname}.wastickers', f'./{pname}.wastickers')
|
copyfile(f'./tmp/{pname}.wastickers', f'./{pname}.wastickers')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue