-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 048c897
Showing
6 changed files
with
91 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
./tmp |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# SignPic String Generator | ||
|
||
A command-line interface for generating strings for use with the [SignPic mod](https://ftb.fandom.com/wiki/SignPic). | ||
|
||
I made this because I was bored. | ||
|
||
## Usage | ||
### Windows | ||
|
||
Download `signpic-generator.pyz` from the Releases page. Open command prompt and execute it with `python signpic-generator.pyz --help`. | ||
|
||
## Linux (and Mac maybe?) | ||
|
||
Download `signpic-generator` from the Releases page and execute with `signpic-generator --help`. |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env just --justfile | ||
|
||
zipapp-build: | ||
-mkdir ./tmp | ||
python3 -m zipapp ./src --output ./tmp/signpic-generator.pyz | ||
echo '#!/usr/bin/env python3' | cat - ./tmp/signpic-generator.pyz > ./tmp/signpic-generator | ||
chmod +x ./tmp/signpic-generator |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(prog="signpic-generator", | ||
description='Generate a string for the SignPic Minecraft mod.', | ||
epilog="For more information on this string format, see https://ftb.fandom.com/wiki/SignPic.") | ||
|
||
parser.add_argument('--url', "-u", | ||
metavar='url', | ||
type=str, | ||
help='the URL of the image to show in the sign, including http:// or https://') | ||
|
||
parser.add_argument('--image-width', "-iw", | ||
metavar='width', | ||
type=str, | ||
help='the width of the image to display') | ||
|
||
parser.add_argument('--image-height', "-ih", | ||
metavar='width', | ||
type=str, | ||
help='the height of the image to display') | ||
|
||
parser.add_argument('--width-offset', "-wo", | ||
metavar='width', | ||
type=str, | ||
help='the width of the image offset') | ||
|
||
parser.add_argument('--height-offset', '-ho', | ||
metavar='width', | ||
type=str, | ||
help='the height of the image offset') | ||
|
||
parser.add_argument('-v', '--vertical', | ||
action='store_true', | ||
help='change the orientation of the image to vertical') | ||
|
||
|
||
def string_formatter(url: str, | ||
image_width: str, | ||
image_height: str, | ||
width_offset: str, | ||
height_offset: str, | ||
vertical: str | ||
): | ||
if vertical: | ||
vertical = "R" | ||
else: | ||
vertical = "" | ||
|
||
if url.startswith("https://"): | ||
secure = "$" | ||
else: | ||
secure = "" | ||
|
||
url = url.replace("http://", "") | ||
url = url.replace("https://", "") | ||
|
||
return f"#{secure}{url}{{{image_width}x{image_height}, {width_offset}x{height_offset}{vertical}}}" | ||
|
||
|
||
args = parser.parse_args() | ||
|
||
print(string_formatter( | ||
url=args.url, | ||
image_width=args.image_width, | ||
image_height=args.image_height, | ||
width_offset=args.width_offset, | ||
height_offset=args.height_offset, | ||
vertical=args.vertical | ||
)) |
Binary file not shown.
Binary file not shown.