From 2aaba691016b2646723dcfcd84069bb8bad79e79 Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 3 Jun 2021 21:34:14 -0400 Subject: [PATCH] feat: add unofficial repo --- generate_pluginmaster.py | 35 ++++++++----- pluginmaster.json | 48 ++++++------------ unofficial.json | 18 +++++++ .../RoleplayersToolbox/latest.zip | Bin 4 files changed, 55 insertions(+), 46 deletions(-) create mode 100644 unofficial.json rename {plugins => unofficial}/RoleplayersToolbox/latest.zip (100%) diff --git a/generate_pluginmaster.py b/generate_pluginmaster.py index 988e9a8..0e9cd4d 100644 --- a/generate_pluginmaster.py +++ b/generate_pluginmaster.py @@ -29,25 +29,32 @@ TRIMMED_KEYS = [ ] def main(): + plugins_dir = argv[1] if len(argv) > 1 else 'plugins' + master_name = 'pluginmaster.json' if plugins_dir == 'plugins' else f'{plugins_dir}.json' + info = { + 'plugins_dir': plugins_dir, + 'master_name': master_name, + } + # extract the manifests from inside the zip files - master = extract_manifests() + master = extract_manifests(info) # trim the manifests master = [trim_manifest(manifest) for manifest in master] # convert the list of manifests into a master list - add_extra_fields(master) + add_extra_fields(info, master) # write the master - write_master(master) + write_master(info, master) # update the LastUpdated field in master - last_updated() + last_updated(info) -def extract_manifests(): +def extract_manifests(info): manifests = [] - for dirpath, dirnames, filenames in os.walk('./plugins'): + for dirpath, dirnames, filenames in os.walk(f'./{info["plugins_dir"]}'): if len(filenames) == 0 or 'latest.zip' not in filenames: continue plugin_name = dirpath.split('/')[-1] @@ -58,10 +65,10 @@ def extract_manifests(): return manifests -def add_extra_fields(manifests): +def add_extra_fields(info, manifests): for manifest in manifests: # generate the download link from the internal assembly name - manifest['DownloadLinkInstall'] = f'https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/{manifest["InternalName"]}/latest.zip' + manifest['DownloadLinkInstall'] = f'https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/{info["plugins_dir"]}/{manifest["InternalName"]}/latest.zip' # add default values if missing for k, v in DEFAULTS.items(): if k not in manifest: @@ -72,26 +79,26 @@ def add_extra_fields(manifests): if k not in manifest: manifest[k] = manifest[source] -def write_master(master): +def write_master(info, master): # write as pretty json - with open('pluginmaster.json', 'w') as f: + with open(info['master_name'], 'w') as f: json.dump(master, f, indent=4) def trim_manifest(plugin): return {k: plugin[k] for k in TRIMMED_KEYS if k in plugin} -def last_updated(): - with open('pluginmaster.json') as f: +def last_updated(info): + with open(info['master_name']) as f: master = json.load(f) for plugin in master: - latest = f'plugins/{plugin["InternalName"]}/latest.zip' + latest = f'{info["plugins_dir"]}/{plugin["InternalName"]}/latest.zip' modified = int(getmtime(latest)) if 'LastUpdated' not in plugin or modified != int(plugin['LastUpdated']): plugin['LastUpdated'] = str(modified) - with open('pluginmaster.json', 'w') as f: + with open(info['master_name'], 'w') as f: json.dump(master, f, indent=4) if __name__ == '__main__': diff --git a/pluginmaster.json b/pluginmaster.json index e11d161..ba52c22 100644 --- a/pluginmaster.json +++ b/pluginmaster.json @@ -1,19 +1,18 @@ [ { "Author": "ascclemens", - "Name": "The Roleplayer's Toolbox", - "Description": "A collection of useful tools for roleplayers.\n\n- Choose a PF or use the /route command to set a destination and get\n told the fastest way to navigate to any house.\n- Enable click-to-examine on left or right click.\n- Prevent untargeting or changing your target.\n- Set any emote on your hotbar, such as sleep or object sit.\n- Add the /emoteid command to use any emote by its ID.\n- Disable the /doze emote snap so you can use the sleep emote\n anywhere.", - "InternalName": "RoleplayersToolbox", - "AssemblyVersion": "0.1.0", - "RepoUrl": "https://git.sr.ht/~jkcclemens/RoleplayersToolbox", + "Name": "Python REPL", + "Description": "Allows you to use Dalamud via Python in the chat box.\n\nSupports one-liners, printing results to chat, or making full scripts over multiple commands.", + "InternalName": "DalamudPython", + "AssemblyVersion": "1.1.2", "ApplicableVersion": "any", "DalamudApiLevel": 3, - "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/RoleplayersToolbox/latest.zip", + "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/DalamudPython/latest.zip", "IsHide": false, "IsTestingExclusive": false, - "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/RoleplayersToolbox/latest.zip", - "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/RoleplayersToolbox/latest.zip", - "LastUpdated": "1622507915" + "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/DalamudPython/latest.zip", + "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/DalamudPython/latest.zip", + "LastUpdated": "1622770041" }, { "Author": "ascclemens", @@ -24,27 +23,12 @@ "RepoUrl": "https://git.sr.ht/~jkcclemens/HUDManager", "ApplicableVersion": "any", "DalamudApiLevel": 3, - "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/HUD Manager/latest.zip", + "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/HUD Manager/latest.zip", "IsHide": false, "IsTestingExclusive": false, - "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/HUD Manager/latest.zip", - "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/HUD Manager/latest.zip", - "LastUpdated": "1618547356" - }, - { - "Author": "ascclemens", - "Name": "Python REPL", - "Description": "Allows you to use Dalamud via Python in the chat box.\n\nSupports one-liners, printing results to chat, or making full scripts over multiple commands.", - "InternalName": "DalamudPython", - "AssemblyVersion": "1.1.2", - "ApplicableVersion": "any", - "DalamudApiLevel": 3, - "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/DalamudPython/latest.zip", - "IsHide": false, - "IsTestingExclusive": false, - "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/DalamudPython/latest.zip", - "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/DalamudPython/latest.zip", - "LastUpdated": "1618547374" + "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/HUD Manager/latest.zip", + "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/HUD Manager/latest.zip", + "LastUpdated": "1622770041" }, { "Author": "ascclemens", @@ -54,11 +38,11 @@ "AssemblyVersion": "1.0.0", "ApplicableVersion": "any", "DalamudApiLevel": 3, - "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/Macrology/latest.zip", + "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/Macrology/latest.zip", "IsHide": false, "IsTestingExclusive": false, - "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/Macrology/latest.zip", - "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/Macrology/latest.zip", - "LastUpdated": "1618547517" + "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/Macrology/latest.zip", + "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/Macrology/latest.zip", + "LastUpdated": "1622770041" } ] \ No newline at end of file diff --git a/unofficial.json b/unofficial.json new file mode 100644 index 0000000..ca9ef6e --- /dev/null +++ b/unofficial.json @@ -0,0 +1,18 @@ +[ + { + "Author": "ascclemens", + "Name": "The Roleplayer's Toolbox", + "Description": "A collection of useful tools for roleplayers.\n\n- Choose a PF or use the /route command to set a destination and get\n told the fastest way to navigate to any house.\n- Enable click-to-examine on left or right click.\n- Prevent untargeting or changing your target.\n- Set any emote on your hotbar, such as sleep or object sit.\n- Add the /emoteid command to use any emote by its ID.\n- Disable the /doze emote snap so you can use the sleep emote\n anywhere.", + "InternalName": "RoleplayersToolbox", + "AssemblyVersion": "0.1.0", + "RepoUrl": "https://git.sr.ht/~jkcclemens/RoleplayersToolbox", + "ApplicableVersion": "any", + "DalamudApiLevel": 3, + "DownloadLinkInstall": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/unofficial/RoleplayersToolbox/latest.zip", + "IsHide": false, + "IsTestingExclusive": false, + "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/unofficial/RoleplayersToolbox/latest.zip", + "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/unofficial/RoleplayersToolbox/latest.zip", + "LastUpdated": "1622770041" + } +] \ No newline at end of file diff --git a/plugins/RoleplayersToolbox/latest.zip b/unofficial/RoleplayersToolbox/latest.zip similarity index 100% rename from plugins/RoleplayersToolbox/latest.zip rename to unofficial/RoleplayersToolbox/latest.zip