MinetestModCleaner/example.py

33 lines
885 B
Python
Raw Normal View History

2014-02-05 05:44:08 -08:00
from modmanager import *
# Create cleaner
cleaner = ModManager("working_directory")
# Run on existing mod
# Parameters
# location: path to the archive
# title: the human readable name of the mod
# name: the mod namespace
# (optional) desc: the description to go in description.txt
# (optional) image: the path to the mod image to be copied to screenshot.png
res = cleaner.run("food.zip","Food Mod","food","This is the food mod","")
2014-02-05 10:33:16 -08:00
# returns a CheckResult object
# Get the new zipped archive
res.file
# Check for security risks
if res.safe == 0:
print("Mod is safe!")
else:
print("Security risks detected: "+res.safe)
2014-02-05 05:44:08 -08:00
# The same, but gets from github instead of location
2014-02-05 09:48:48 -08:00
res = cleaner.githubGet("https://github.com/rubenwardy/awards","Achievements","awards","This is the award mod","")
2014-02-05 05:45:06 -08:00
# Get messages in HTML format
cleaner.reportHTML()
# Clear messages
cleaner.clear()