-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform script adjustments for Windows
- Loading branch information
1 parent
a9c3e99
commit 5e381e3
Showing
4 changed files
with
22 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os, sys, platform, tempfile, subprocess | ||
|
||
system = platform.system() | ||
if system == "Windows": | ||
browser = "start" | ||
elif system == "Darwin": | ||
browser = "open" | ||
else: | ||
browser = "xdg-open" | ||
|
||
if len(sys.argv) != 2: | ||
print(f"Usage: {sys.argv[0]} FILE", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
input = sys.argv[1] | ||
tmp_dir = tempfile.gettempdir() | ||
output = os.path.join(tmp_dir, "dharma_output.html") | ||
|
||
subprocess.run(["curl", "-s", "-F", f"file=@{input}", "-o", output, "https://dharmalekha.info/convert"], check=True) | ||
subprocess.run([browser, output]) | ||
#!/usr/bin/env python3 | ||
|
||
import os, sys, platform, tempfile, subprocess | ||
|
||
system = platform.system() | ||
if system == "Windows": | ||
browser, shell = "start", True | ||
elif system == "Darwin": | ||
browser, shell = "open", False | ||
else: | ||
browser, shell = "xdg-open", False | ||
|
||
if len(sys.argv) != 2: | ||
print(f"Usage: {sys.argv[0]} FILE", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
input = sys.argv[1] | ||
tmp_dir = tempfile.gettempdir() | ||
output = os.path.join(tmp_dir, "dharma_output.html") | ||
|
||
subprocess.run(["curl", "-s", "-F", f"file=@{input}", "-o", output, "https://dharmalekha.info/convert"], check=True) | ||
subprocess.run([browser, output], shell=shell) |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.