Files
roll20-character-sheets/Mythras/upload2roll20.py
Matthew Carpenter 5afa988338 Mythras v2.7 (#5502)
* Spanish translation and minor fixes

* Rounding movement measurements

* Adding linguistics option to campaign settings

* Removing NPC stuff from the json options

* Saving Mythras v2 progress

* Modify mythras sheet.json for new options

* stash

* Restored tranlastions and all but mook css

* Automation script added to help building Mythras sheets

* Autocalc migration up to skills, Mythras

* sheetwork autocalc for standard skills

* Auto calc up to passions

* Fix tenacity

* Finish migrating skills to shett workers

* Finished skills auto calc

* Half done with compat tab

* Stash work up to mostly finish mook skills

* Fixed percent symbol on Athletics mook btn

* Added up to psionic powers for mooks and added collapse to magic sections

* Stash mook sup to animism

* more stashed edits

* Stash commits

* v2 Mythras

* A few edits to Mythras changelog, typos and spelling

* Style adjustments for Firefox

* Small bugfixes for the Mythras v2 conversion scripts

* Small bugfixes for the Mythras v2 conversion scripts

* Some minor CSS adjustments to support Firefox better

* Mythras: fix styling issues with fetish tenacity

* v2.1 of Mythras sheet and reduce M-Space to a stub with notes to use the Mythras sheet

* Remove line from Mythras change log which wasn't meant for publishing

* v2.2 of Mythras sheet

* Added missing Worlds United setting from Default Sheet Settings

* v2.3 of Mythras Sheet

* Add missing v2.3 version update

* Mythras v2.4 and Odd Soot stub

* Update Odd Soot Logo

* Removing Odd Soot sheet per clevett's recommendation

* Restore M-Space to previous versions per clevett's recommendation

* Added deprecation notice to top of M-Space sheet

* Mythras v2.5

* Added equipment and money to compact/mook sheets

* Added Social Conflict Support

* Update changelop for v2.6

* Update de.json

* Mythras - switching over to gradle based build with automated uploading of srcs to roll20

* Mythras v2.7

* Updated Mythras Changlog
2019-09-30 14:01:10 -05:00

50 lines
1.4 KiB
Python

import json
import requests
from pathlib import Path
home = str(Path.home())
with open("{}/.roll20/config.json".format(home)) as config_file:
configs = json.load(config_file)
login_data = {'email': configs['email'], 'password': configs['password']}
roll20session = requests.Session()
login_result = roll20session.post('https://app.roll20.net/sessions/create', login_data)
if login_result:
print("Roll20 login successful.")
else:
print("Error logging into Roll20!")
exit(1)
with open('Mythras.html', 'r') as html_file:
html_src = html_file.read()
with open('Mythras.css', 'r') as css_file:
css_src = css_file.read()
with open('translation.json', 'r') as translation_file:
translation_src = translation_file.read()
sheet_data = {
'publicaccess': 'true',
'bgimage': 'none',
'allowcharacterimport': 'true',
'scale_units': 'ft',
'grid_type': 'square',
'diagonaltype': 'foure',
'bar_location': 'above',
'barStyle': 'standard',
'compendium_override': '',
'sharecompendiums': 'false',
'charsheettype': 'custom',
'customcharsheet_layout': html_src,
'customcharsheet_style': css_src,
'customcharsheet_translation': translation_src
}
upload_result = roll20session.post("https://app.roll20.net/campaigns/savesettings/{}".format(configs['campaign']), sheet_data)
if upload_result:
print("Sheet uploaded successfully.")
else:
print("Error uploading sheet content!")
exit(2)