diff --git a/setup.py b/setup.py
index 69d2a86..83b2b2c 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
setuptools.setup(
name="share-snootclub",
- version="0.0.0",
+ version="0.0.1",
author="chee",
author_email="chee@snoot.club",
description="share to share.snoot.club",
diff --git a/share/__main__.py b/share/__main__.py
index ec775e5..be86c39 100755
--- a/share/__main__.py
+++ b/share/__main__.py
@@ -9,7 +9,6 @@
from slugify import slugify
from .getseq import getseq
-
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
@@ -44,13 +43,22 @@ def main():
args = parser.parse_args()
mimetypes.init()
+ source = None
if args.file.startswith("/tmp/.psub") or args.file.startswith("/dev/fd"):
+ source = args.file
prefix = getseq()
head = open(args.file, "rb").read(2048)
ext = mimetypes.guess_extension(magic.from_buffer(head, True))
output_filename = f"{prefix}{ext}"
+ elif args.file.startswith("https://") or args.file.startswith("http://"):
+ source = f"/tmp/{getseq()}.html"
+ with open(source, "t+w") as file:
+ file.write(f"""{args.file}""")
+
+ output_filename = "index.html"
else:
+ source = args.file
[name, ext] = os.path.splitext(os.path.basename(args.file))
output_filename = f"{slugify(name)}{ext}"
@@ -65,11 +73,14 @@ def main():
"-zL",
"--progress",
"--chmod=a+rw",
- args.file,
+ source,
f"{ssh_target}:{destdir}/{output_filename}"
], stdout=PIPE)
- print(f"{args.public_root}/{dirname}/{output_filename}")
+ output = f"{args.public_root}/{dirname}/"
+ if output_filename is not "index.html":
+ output += output_filename
+ print(output)
if __name__ == "__main__":
diff --git a/share_chee.egg-info/SOURCES.txt b/share_chee.egg-info/SOURCES.txt
index 9dae6c1..dfafaaf 100644
--- a/share_chee.egg-info/SOURCES.txt
+++ b/share_chee.egg-info/SOURCES.txt
@@ -1,4 +1,5 @@
setup.py
+share
share/__init__.py
share/__main__.py
share/getseq.py