From 5d354d0b1131667e7b43a02832730cacee2b417e Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Thu, 25 May 2017 06:50:27 -0700 Subject: [PATCH] Changed templates so they can be imported into omnivore * template images now have file extension * .inf files are now in json format, including some omnivore metadata --- atrcopy/__init__.py | 12 ++++++++---- atrcopy/templates/{dos2dd => dos2dd.atr} | Bin atrcopy/templates/dos2dd.atr.inf | 1 + atrcopy/templates/dos2dd.inf | 1 - atrcopy/templates/{dos2ed+2.5 => dos2ed+2.5.atr} | Bin atrcopy/templates/dos2ed+2.5.atr.inf | 1 + atrcopy/templates/dos2ed+2.5.inf | 1 - atrcopy/templates/{dos2ed => dos2ed.atr} | Bin atrcopy/templates/dos2ed.atr.inf | 1 + atrcopy/templates/dos2ed.inf | 1 - atrcopy/templates/{dos2sd+2.0s => dos2sd+2.0s.atr} | Bin atrcopy/templates/dos2sd+2.0s.atr.inf | 1 + atrcopy/templates/dos2sd+2.0s.inf | 1 - atrcopy/templates/{dos2sd => dos2sd.atr} | Bin atrcopy/templates/dos2sd.atr.inf | 1 + atrcopy/templates/dos2sd.inf | 1 - atrcopy/templates/{dos33 => dos33.dsk} | Bin atrcopy/templates/dos33.dsk.inf | 1 + atrcopy/templates/dos33.inf | 1 - .../templates/{dos33autobrun => dos33autobrun.dsk} | Bin atrcopy/templates/dos33autobrun.dsk.inf | 1 + atrcopy/templates/dos33autobrun.inf | 1 - 22 files changed, 15 insertions(+), 11 deletions(-) rename atrcopy/templates/{dos2dd => dos2dd.atr} (100%) create mode 100644 atrcopy/templates/dos2dd.atr.inf delete mode 100644 atrcopy/templates/dos2dd.inf rename atrcopy/templates/{dos2ed+2.5 => dos2ed+2.5.atr} (100%) mode change 100755 => 100644 create mode 100644 atrcopy/templates/dos2ed+2.5.atr.inf delete mode 100644 atrcopy/templates/dos2ed+2.5.inf rename atrcopy/templates/{dos2ed => dos2ed.atr} (100%) create mode 100644 atrcopy/templates/dos2ed.atr.inf delete mode 100644 atrcopy/templates/dos2ed.inf rename atrcopy/templates/{dos2sd+2.0s => dos2sd+2.0s.atr} (100%) create mode 100644 atrcopy/templates/dos2sd+2.0s.atr.inf delete mode 100644 atrcopy/templates/dos2sd+2.0s.inf rename atrcopy/templates/{dos2sd => dos2sd.atr} (100%) create mode 100644 atrcopy/templates/dos2sd.atr.inf delete mode 100644 atrcopy/templates/dos2sd.inf rename atrcopy/templates/{dos33 => dos33.dsk} (100%) create mode 100644 atrcopy/templates/dos33.dsk.inf delete mode 100644 atrcopy/templates/dos33.inf rename atrcopy/templates/{dos33autobrun => dos33autobrun.dsk} (100%) create mode 100644 atrcopy/templates/dos33autobrun.dsk.inf delete mode 100644 atrcopy/templates/dos33autobrun.inf diff --git a/atrcopy/__init__.py b/atrcopy/__init__.py index 1a590c1..bb1621b 100644 --- a/atrcopy/__init__.py +++ b/atrcopy/__init__.py @@ -4,6 +4,7 @@ from builtins import str import os import sys import zlib +import json import logging log = logging.getLogger(__name__) @@ -300,7 +301,9 @@ def get_template_info(): continue try: with open(name + ".inf", "r") as fh: - description = fh.read().strip() + s = fh.read() + j = json.loads(s) + description = j["description"] except IOError: description = "" d = textwrap.wrap(description, 80 - 1 - 14 - 2 - 2) @@ -318,9 +321,10 @@ def get_template_data(template): raise InvalidDiskImage("Template disk image %s not found" % template) try: with open(path + ".inf", "r") as fh: - inf = fh.read().strip() + s = fh.read() + inf = json.loads(s) except IOError: - inf = "" + inf = {"description": ""} return data, inf @@ -328,7 +332,7 @@ def create_image(template, name): import textwrap data, inf = get_template_data(template) - print("using %s template:\n %s" % (template, "\n ".join(textwrap.wrap(inf, 77)))) + print("using %s template:\n %s" % (template, "\n ".join(textwrap.wrap(inf["description"], 77)))) if not options.dry_run: if os.path.exists(name) and not options.force: print("skipping %s, use -f to overwrite" % (name)) diff --git a/atrcopy/templates/dos2dd b/atrcopy/templates/dos2dd.atr similarity index 100% rename from atrcopy/templates/dos2dd rename to atrcopy/templates/dos2dd.atr diff --git a/atrcopy/templates/dos2dd.atr.inf b/atrcopy/templates/dos2dd.atr.inf new file mode 100644 index 0000000..284a1f3 --- /dev/null +++ b/atrcopy/templates/dos2dd.atr.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Atari 8-bit DOS 2 double density (180K), empty VTOC", "label": "Atari DOS 2 DD (180K) blank image", "ext": "atr"} diff --git a/atrcopy/templates/dos2dd.inf b/atrcopy/templates/dos2dd.inf deleted file mode 100644 index 781880c..0000000 --- a/atrcopy/templates/dos2dd.inf +++ /dev/null @@ -1 +0,0 @@ -Atari 8-bit DOS 2 double density (180K), empty VTOC diff --git a/atrcopy/templates/dos2ed+2.5 b/atrcopy/templates/dos2ed+2.5.atr old mode 100755 new mode 100644 similarity index 100% rename from atrcopy/templates/dos2ed+2.5 rename to atrcopy/templates/dos2ed+2.5.atr diff --git a/atrcopy/templates/dos2ed+2.5.atr.inf b/atrcopy/templates/dos2ed+2.5.atr.inf new file mode 100644 index 0000000..5eb32fb --- /dev/null +++ b/atrcopy/templates/dos2ed+2.5.atr.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Atari 8-bit DOS 2 enhanced density (130K) DOS 2.5 system disk", "label": "Atari DOS 2.5 ED (130K) system disk", "ext": "atr"} diff --git a/atrcopy/templates/dos2ed+2.5.inf b/atrcopy/templates/dos2ed+2.5.inf deleted file mode 100644 index 34c5a0f..0000000 --- a/atrcopy/templates/dos2ed+2.5.inf +++ /dev/null @@ -1 +0,0 @@ -Atari 8-bit DOS 2 enhanced density (130K) DOS 2.5 system disk diff --git a/atrcopy/templates/dos2ed b/atrcopy/templates/dos2ed.atr similarity index 100% rename from atrcopy/templates/dos2ed rename to atrcopy/templates/dos2ed.atr diff --git a/atrcopy/templates/dos2ed.atr.inf b/atrcopy/templates/dos2ed.atr.inf new file mode 100644 index 0000000..cc3b315 --- /dev/null +++ b/atrcopy/templates/dos2ed.atr.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Atari 8-bit DOS 2 enhanced density (130K), empty VTOC", "label": "Atari DOS 2 ED (130K) blank image", "ext": "atr"} diff --git a/atrcopy/templates/dos2ed.inf b/atrcopy/templates/dos2ed.inf deleted file mode 100644 index 8540706..0000000 --- a/atrcopy/templates/dos2ed.inf +++ /dev/null @@ -1 +0,0 @@ -Atari 8-bit DOS 2 enhanced density (130K), empty VTOC diff --git a/atrcopy/templates/dos2sd+2.0s b/atrcopy/templates/dos2sd+2.0s.atr similarity index 100% rename from atrcopy/templates/dos2sd+2.0s rename to atrcopy/templates/dos2sd+2.0s.atr diff --git a/atrcopy/templates/dos2sd+2.0s.atr.inf b/atrcopy/templates/dos2sd+2.0s.atr.inf new file mode 100644 index 0000000..78e2c8e --- /dev/null +++ b/atrcopy/templates/dos2sd+2.0s.atr.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Atari 8-bit DOS 2 single density (90K) DOS 2.0S system disk", "label": "Atari DOS 2.0S SD (90K) system disk", "ext": "atr"} diff --git a/atrcopy/templates/dos2sd+2.0s.inf b/atrcopy/templates/dos2sd+2.0s.inf deleted file mode 100644 index 503f0cc..0000000 --- a/atrcopy/templates/dos2sd+2.0s.inf +++ /dev/null @@ -1 +0,0 @@ -Atari 8-bit DOS 2 single density (90K) DOS 2.0S system disk diff --git a/atrcopy/templates/dos2sd b/atrcopy/templates/dos2sd.atr similarity index 100% rename from atrcopy/templates/dos2sd rename to atrcopy/templates/dos2sd.atr diff --git a/atrcopy/templates/dos2sd.atr.inf b/atrcopy/templates/dos2sd.atr.inf new file mode 100644 index 0000000..6302107 --- /dev/null +++ b/atrcopy/templates/dos2sd.atr.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Atari 8-bit DOS 2 single density (90K), empty VTOC", "label": "Atari DOS 2 SD (90K) blank image", "ext": "atr"} diff --git a/atrcopy/templates/dos2sd.inf b/atrcopy/templates/dos2sd.inf deleted file mode 100644 index 8868452..0000000 --- a/atrcopy/templates/dos2sd.inf +++ /dev/null @@ -1 +0,0 @@ -Atari 8-bit DOS 2 single density (90K), empty VTOC diff --git a/atrcopy/templates/dos33 b/atrcopy/templates/dos33.dsk similarity index 100% rename from atrcopy/templates/dos33 rename to atrcopy/templates/dos33.dsk diff --git a/atrcopy/templates/dos33.dsk.inf b/atrcopy/templates/dos33.dsk.inf new file mode 100644 index 0000000..5305c24 --- /dev/null +++ b/atrcopy/templates/dos33.dsk.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Apple ][ DOS 3.3 (140K) standard RWTS, empty VTOC", "label": "Apple DOS 3.3 (140K) blank image", "ext": "dsk"} diff --git a/atrcopy/templates/dos33.inf b/atrcopy/templates/dos33.inf deleted file mode 100644 index 79d38ae..0000000 --- a/atrcopy/templates/dos33.inf +++ /dev/null @@ -1 +0,0 @@ -Apple ][ DOS 3.3 (140K) standard RWTS, empty VTOC diff --git a/atrcopy/templates/dos33autobrun b/atrcopy/templates/dos33autobrun.dsk similarity index 100% rename from atrcopy/templates/dos33autobrun rename to atrcopy/templates/dos33autobrun.dsk diff --git a/atrcopy/templates/dos33autobrun.dsk.inf b/atrcopy/templates/dos33autobrun.dsk.inf new file mode 100644 index 0000000..aeac1b9 --- /dev/null +++ b/atrcopy/templates/dos33autobrun.dsk.inf @@ -0,0 +1 @@ +{"task": "hex_edit", "description": "Apple ][ DOS 3.3 (140K) disk image for binary program development: HELLO sets fullscreen HGR and calls BRUN on user-supplied AUTOBRUN binary file", "label": "Apple DOS 3.3 (140K) AUTOBRUN image", "ext": "dsk"} diff --git a/atrcopy/templates/dos33autobrun.inf b/atrcopy/templates/dos33autobrun.inf deleted file mode 100644 index b34af1b..0000000 --- a/atrcopy/templates/dos33autobrun.inf +++ /dev/null @@ -1 +0,0 @@ -Apple ][ DOS 3.3 (140K) disk image for binary program development: HELLO sets fullscreen HGR and calls BRUN on user-supplied AUTOBRUN binary file