cnvogelg / amitools

Various tools for using AmigaOS programs on other platforms
258 stars 72 forks source link

JSON Output #138

Closed ryanm101 closed 2 years ago

ryanm101 commented 4 years ago
PhysicalDisk:               0    55999    14336000  6.8Gi  heads=8 sectors=32 block_size=512
LogicalDisk:                2    55999    14335488  6.8Gi  rdb_blks=[0:511,#512] used=[hi=66,#67] cyl_blks=256
Partition: #0 'DH0'         2     1601      409600  200Mi    2.86%  DOS5/0x444f5305
                                                                      blk_longs=128, sec/blk=1, surf=8, blk/trk=32
                                                                      fs_block_size=512
                                                                      max_transfer=0xffffff
                                                                      mask=0x7ffffffe
                                                                      num_buffer=30
                                                                      bootable=1 pri=0
                                                                      automount=1
Partition: #1 'DH1'      1602     3201      409600  200Mi    2.86%  DOS5/0x444f5305
                                                                      blk_longs=128, sec/blk=1, surf=8, blk/trk=32
                                                                      fs_block_size=512
                                                                      max_transfer=0xffffff
                                                                      mask=0x7ffffffe
                                                                      num_buffer=30
                                                                      bootable=0
                                                                      automount=1
Partition: #2 'DH2'      3202    55999    13516288  6.4Gi   94.29%  DOS5/0x444f5305
                                                                      blk_longs=128, sec/blk=1, surf=8, blk/trk=32
                                                                      fs_block_size=512
                                                                      max_transfer=0xffffff
                                                                      mask=0x7ffffffe
                                                                      num_buffer=30
                                                                      bootable=0
                                                                      automount=1
FileSystem #0 DOS3/0x444f5303 version=46.13 size=30168 seg_list_blk=0x5 global_vec=0xffffffff

I'd like to convert this to json output by adding an option to output json to rdbtool.

{
    "physicalDisk": {
        "start_cyl": 0,
        "end_cyl": 55999,
        "????": 14336000,
        "size": 6963.2,
        "heads": 8,
        "sectors": 32,
        "block_size": 512
    },
    "filesystem": {
        "0": {
            "type": "DOS3/0x444f5303",
            "version": 46.13,
            "size": 30168,
            "eg_list_blk": "0x5",
            "global_vec": "0xffffffff"
        }
    },
    "logicalDisk": {
        "start_cyl": 2,
        "end_cyl": 55999,
        "blocks": 14336000,
        "size": 6963.2,
        "rdb_blks": ['0:511,#512'],
        "used": ['hi=66', '#67'],
        "cyl_blks": 256,
        "partitions":{
            "0" :{
                "label": 'DH0',
                "start_cyl": 2,
                "end_cyl": 1601,
                "blocks": 409600,
                "size": 200,
                "percentage": 2.86,
                "type": "DOS5",
                "type_hex": 0x444f5305,
                "blk_longs": 128,
                "sec/blk": 1,
                "surf": 8,
                "blk/trk": 32,
                "fs_block_size": 512,
                "max_transfer": 0xffffff,
                "mask": 0x7ffffffe,
                "num_buffer": 30,
                "bootable": 1,
                "pri": 0,
                "automount":1
            },
            "1": {
                "label": 'DH1',
                "start_cyl": 1602,
                "end_cyl": 3201,
                "blocks": 409600,
                "size": 200,
                "percentage": 2.86,
                "type": "DOS5",
                "type_hex": 0x444f5305,
                "blk_longs": 128,
                "sec/blk": 1,
                "surf": 8,
                "blk/trk": 32,
                "fs_block_size": 512,
                "max_transfer": 0xffffff,
                "mask": 0x7ffffffe,
                "num_buffer": 30,
                "bootable": 0,
                "automount": 1
            }
        }
    }
}

Would you accept a PR if I add this? I think it would help scripting etc as you dont need to parse text

ryanm101 commented 4 years ago

https://github.com/cnvogelg/amitools/pull/139

cnvogelg commented 2 years ago

Finally added in a2850a8