feat: add unofficial repo

This commit is contained in:
Anna 2021-06-03 21:34:14 -04:00
parent 605b1a9d74
commit 2aaba69101
4 changed files with 55 additions and 46 deletions

View File

@ -29,25 +29,32 @@ TRIMMED_KEYS = [
] ]
def main(): 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 # extract the manifests from inside the zip files
master = extract_manifests() master = extract_manifests(info)
# trim the manifests # trim the manifests
master = [trim_manifest(manifest) for manifest in master] master = [trim_manifest(manifest) for manifest in master]
# convert the list of manifests into a master list # convert the list of manifests into a master list
add_extra_fields(master) add_extra_fields(info, master)
# write the master # write the master
write_master(master) write_master(info, master)
# update the LastUpdated field in master # update the LastUpdated field in master
last_updated() last_updated(info)
def extract_manifests(): def extract_manifests(info):
manifests = [] 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: if len(filenames) == 0 or 'latest.zip' not in filenames:
continue continue
plugin_name = dirpath.split('/')[-1] plugin_name = dirpath.split('/')[-1]
@ -58,10 +65,10 @@ def extract_manifests():
return manifests return manifests
def add_extra_fields(manifests): def add_extra_fields(info, manifests):
for manifest in manifests: for manifest in manifests:
# generate the download link from the internal assembly name # 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 # add default values if missing
for k, v in DEFAULTS.items(): for k, v in DEFAULTS.items():
if k not in manifest: if k not in manifest:
@ -72,26 +79,26 @@ def add_extra_fields(manifests):
if k not in manifest: if k not in manifest:
manifest[k] = manifest[source] manifest[k] = manifest[source]
def write_master(master): def write_master(info, master):
# write as pretty json # 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) json.dump(master, f, indent=4)
def trim_manifest(plugin): def trim_manifest(plugin):
return {k: plugin[k] for k in TRIMMED_KEYS if k in plugin} return {k: plugin[k] for k in TRIMMED_KEYS if k in plugin}
def last_updated(): def last_updated(info):
with open('pluginmaster.json') as f: with open(info['master_name']) as f:
master = json.load(f) master = json.load(f)
for plugin in master: for plugin in master:
latest = f'plugins/{plugin["InternalName"]}/latest.zip' latest = f'{info["plugins_dir"]}/{plugin["InternalName"]}/latest.zip'
modified = int(getmtime(latest)) modified = int(getmtime(latest))
if 'LastUpdated' not in plugin or modified != int(plugin['LastUpdated']): if 'LastUpdated' not in plugin or modified != int(plugin['LastUpdated']):
plugin['LastUpdated'] = str(modified) 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) json.dump(master, f, indent=4)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1,19 +1,18 @@
[ [
{ {
"Author": "ascclemens", "Author": "ascclemens",
"Name": "The Roleplayer's Toolbox", "Name": "Python REPL",
"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.", "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": "RoleplayersToolbox", "InternalName": "DalamudPython",
"AssemblyVersion": "0.1.0", "AssemblyVersion": "1.1.2",
"RepoUrl": "https://git.sr.ht/~jkcclemens/RoleplayersToolbox",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 3, "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, "IsHide": false,
"IsTestingExclusive": false, "IsTestingExclusive": false,
"DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/RoleplayersToolbox/latest.zip", "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/DalamudPython/latest.zip",
"DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/RoleplayersToolbox/latest.zip", "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/DalamudPython/latest.zip",
"LastUpdated": "1622507915" "LastUpdated": "1622770041"
}, },
{ {
"Author": "ascclemens", "Author": "ascclemens",
@ -24,27 +23,12 @@
"RepoUrl": "https://git.sr.ht/~jkcclemens/HUDManager", "RepoUrl": "https://git.sr.ht/~jkcclemens/HUDManager",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 3, "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, "IsHide": false,
"IsTestingExclusive": false, "IsTestingExclusive": false,
"DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/HUD Manager/latest.zip", "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/HUD Manager/latest.zip",
"DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/HUD Manager/latest.zip", "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/HUD Manager/latest.zip",
"LastUpdated": "1618547356" "LastUpdated": "1622770041"
},
{
"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"
}, },
{ {
"Author": "ascclemens", "Author": "ascclemens",
@ -54,11 +38,11 @@
"AssemblyVersion": "1.0.0", "AssemblyVersion": "1.0.0",
"ApplicableVersion": "any", "ApplicableVersion": "any",
"DalamudApiLevel": 3, "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, "IsHide": false,
"IsTestingExclusive": false, "IsTestingExclusive": false,
"DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/Macrology/latest.zip", "DownloadLinkTesting": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/Macrology/latest.zip",
"DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/master/plugins/Macrology/latest.zip", "DownloadLinkUpdate": "https://git.sr.ht/~jkcclemens/plugin_repo/blob/main/plugins/Macrology/latest.zip",
"LastUpdated": "1618547517" "LastUpdated": "1622770041"
} }
] ]

18
unofficial.json Normal file
View File

@ -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"
}
]