From f2bbfe83b4b23e87d8a049a2d698c6576a5bcd8c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 30 Oct 2023 10:23:49 +0100 Subject: Initial commit --- python/qm-file-manager.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 python/qm-file-manager.py (limited to 'python') diff --git a/python/qm-file-manager.py b/python/qm-file-manager.py new file mode 100755 index 0000000..c022d3e --- /dev/null +++ b/python/qm-file-manager.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import os + +def get(url): + print("title %s" % url) + print("add_tab") + + if url != "/": + print("title Go to parent directory") + print("url ..") + print("thumbnail_url folder.png") + print("thumbnail_size 32x32") + print("add_body_item") + + for entry in os.scandir(url): + print("title %s" % entry.path) + print("url %s" % entry.path) + if entry.is_dir(): + print("thumbnail_url folder.png") + else: + print("thumbnail_url file.png") + print("thumbnail_size 32x32") + print("add_body_item") + +action = os.environ["ACTION"] +if action == "get": + get(os.environ["URL"]) +else: + print("error unexpected action %s" % action) + exit(1) \ No newline at end of file -- cgit v1.2.3