Skip to content

Instantly share code, notes, and snippets.

@jneilliii
Last active January 14, 2023 15:59
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jneilliii/61478a04a1cdaa96ae89549b46de27b8 to your computer and use it in GitHub Desktop.
import json
import requests
import subprocess
# path to file extracted from backup or exported from plugin manager
plugin_list = "C:/Users/jneil/Downloads/backup_test/plugin_list.json"
# load master plugin list.
master_plugin_list = requests.get("https://plugins.octoprint.org/plugins.json").json()
# load plugins from backup file
with open(plugin_list) as file:
plugins = json.load(file)
# loop through master plugin list and if it was in the backup file install it
for plugin in master_plugin_list:
if any(map(lambda r: r["key"] == plugin["id"], plugins)):
print("Installing {}".format(plugin["title"]))
subprocess.run(["pip", "install", plugin["archive"]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment