Skip to content

Commit

Permalink
Local extract and fix stuff in rclone upload
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-dk committed Sep 21, 2021
1 parent 98c0227 commit b4854aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ userdata/
torlog.txt
*.conf
sa_accounts/
sa_files*
15 changes: 14 additions & 1 deletion tortoolkit/uploaders/rclone_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from configparser import ConfigParser
from posix import listdir
import shlex
from sys import path
from ..core.base_task import BaseTask
from ..core.getVars import get_val
Expand Down Expand Up @@ -326,11 +327,23 @@ async def gen_sa_rc_file(self, change=False):

if blob is not None:
fpath = os.path.join(os.getcwd(),"sa_files.zip")
epath = os.path.join(os.getcwd(),"sa_files")

os.makedirs(epath, exist_ok=True)
with open(fpath, "wb") as f:
f.write(blob)
print("file written")
epath = await extract_archive("sa_files.zip")
cmd = f'7z e -y "{fpath}" "-o{epath}"'
cmd = shlex.split(cmd)
process = await asyncio.create_subprocess_exec(
*cmd,
stderr=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE
)

stdout, stderr = await process.communicate()
await clear_stuff(fpath)

sa_folder = epath


Expand Down

0 comments on commit b4854aa

Please sign in to comment.