Run wormhole send!

This commit is contained in:
Luke Murphy 2020-07-22 19:25:53 +02:00
parent cdf964d1b2
commit a508ac588f
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -3,6 +3,8 @@
import asyncio import asyncio
import logging import logging
import os import os
import subprocess
from pathlib import Path
import asyncio_glib import asyncio_glib
import gi import gi
@ -80,7 +82,9 @@ class DropShip:
files = data.get_text().split() files = data.get_text().split()
self.files_to_send = files self.files_to_send = files
if len(files) == 1: if len(files) == 1:
self.schedule(self.wormhole_send(self, files[0])) # TODO(decentral1se): this replace seems funky!?
fpath = Path(files[0].replace("file://", ""))
self.schedule(self.wormhole_send(self, fpath))
self.drop_label.set_text("Sending..") self.drop_label.set_text("Sending..")
else: else:
log.info("Multiple file sending coming soon ™") log.info("Multiple file sending coming soon ™")
@ -99,9 +103,12 @@ class DropShip:
async def wormhole_send(self, widget, fpath): async def wormhole_send(self, widget, fpath):
"""Run `wormhole send` on a local file path.""" """Run `wormhole send` on a local file path."""
log.info(f"Pretending to start wormhole send {fpath}") process = await asyncio.create_subprocess_exec(
await asyncio.sleep(2) "wormhole", "send", fpath, stdout=subprocess.PIPE
log.info(f"Pretending to finish wormhole send {fpath}") )
async for line in process.stdout:
log.info(line)
async def main(): async def main():