mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[+] Global version indexer script
This commit is contained in:
parent
466066f7db
commit
23c17ffbc9
22
servers/get_versions.py
Normal file
22
servers/get_versions.py
Normal file
@ -0,0 +1,22 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
def get_subfolders(folder_path):
|
||||
"""Gets all subfolders within a given folder path."""
|
||||
return [f for f in os.listdir(folder_path) if os.path.isdir(os.path.join(folder_path, f))]
|
||||
|
||||
def main():
|
||||
"""Main function to iterate over folders and create JSON output."""
|
||||
folders_to_scan = ['paper', 'spigot', 'bukkit']
|
||||
subfolder_data = {}
|
||||
|
||||
for folder in folders_to_scan:
|
||||
subfolders = get_subfolders(folder)
|
||||
subfolder_data[folder] = subfolders
|
||||
|
||||
with open('versions.json', 'w') as json_file:
|
||||
json.dump(subfolder_data, json_file, indent=2)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user