Compare commits
No commits in common. "7286d2d460341d04ee18ed99eec15bf0174e26a7" and "68e25bcdccd67c02d57275f9191f5bdb9fcb70fd" have entirely different histories.
7286d2d460
...
68e25bcdcc
|
@ -6,12 +6,11 @@ Python 3.6+
|
||||||
#### Master
|
#### Master
|
||||||
Python packages: `requests bs4`
|
Python packages: `requests bs4`
|
||||||
#### Server
|
#### Server
|
||||||
Python packages: `flask gunicorn passlib argon2_cffi`
|
Python packages: `flask passlib argon2_cffi`
|
||||||
#### Slave
|
#### Slave
|
||||||
Python packages: ` `
|
Python packages: ` `
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### Master
|
|
||||||
`$ python3 overwrought_master.py action [options] [target]`
|
`$ python3 overwrought_master.py action [options] [target]`
|
||||||
__actions__
|
__actions__
|
||||||
* `add` Add a new mod to the modpack. `target` must be a url to a curseforge mod project page. By default, it will prioritize release phases as Release, Beta and then Alpha. `--phase` can alter this. Will always grab the latest version of whichever phase it targets.
|
* `add` Add a new mod to the modpack. `target` must be a url to a curseforge mod project page. By default, it will prioritize release phases as Release, Beta and then Alpha. `--phase` can alter this. Will always grab the latest version of whichever phase it targets.
|
||||||
|
@ -19,5 +18,3 @@ __actions__
|
||||||
* `update` Update a specific mod in the modpack. `target` must be the url associated with the mod. By default, it will prioritize the release phase previously added. `--phase` can alter this. Will only update if the targeted mod is more recent than the one previously downloaded.
|
* `update` Update a specific mod in the modpack. `target` must be the url associated with the mod. By default, it will prioritize the release phase previously added. `--phase` can alter this. Will only update if the targeted mod is more recent than the one previously downloaded.
|
||||||
* `update_all` Update every mod in the modpack. No `target` needed. Will prioritize release phases similar to `update`, however `--phase` will will not affect it.
|
* `update_all` Update every mod in the modpack. No `target` needed. Will prioritize release phases similar to `update`, however `--phase` will will not affect it.
|
||||||
* `summary` Generate a summary page as html. Summary page displays a list of all mods in the modpack and a change log that is updated as changes are made to the modpack.
|
* `summary` Generate a summary page as html. Summary page displays a list of all mods in the modpack and a change log that is updated as changes are made to the modpack.
|
||||||
### Server
|
|
||||||
`gunicorn -b localhost:5000 -e SCRIPT_NAME=/overwrought overwrought_server:app`
|
|
||||||
|
|
|
@ -4,10 +4,6 @@ Configuration settings for overwrought_master.py.
|
||||||
`mc_ver` is used literally when searching for an appropriate verison of
|
`mc_ver` is used literally when searching for an appropriate verison of
|
||||||
a mod to download. Should not include the minor version.
|
a mod to download. Should not include the minor version.
|
||||||
`modpack_name` is used for vanity purposes when naming the modpack.
|
`modpack_name` is used for vanity purposes when naming the modpack.
|
||||||
`password` is the password used for uploading to the remote server.
|
|
||||||
`remote_addr` is the address of the remote Overwrought server.
|
|
||||||
"""
|
"""
|
||||||
mc_ver = "1.12"
|
mc_ver = "1.12"
|
||||||
modpack_name = "motherlode1"
|
modpack_name = "motherlode1"
|
||||||
password = r"""PASSWORD"""
|
|
||||||
remote_addr = "https://stream.steelbea.me/overwrought"
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ A script for updating mods in a minecraft modpack.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
@ -240,36 +241,6 @@ def generate_summary():
|
||||||
file.write(html)
|
file.write(html)
|
||||||
|
|
||||||
|
|
||||||
def post_pack():
|
|
||||||
"""
|
|
||||||
Uploads the modpack to the remote server.
|
|
||||||
"""
|
|
||||||
data = {'password': config_master.password}
|
|
||||||
|
|
||||||
mods = get_all_mods()
|
|
||||||
res = requests.get(config_master.remote_addr + '/get')
|
|
||||||
res.raise_for_status()
|
|
||||||
mods_remote = res.json()
|
|
||||||
mods = [mod for mod in mods if mod.filename not in mods_remote]
|
|
||||||
files = {}
|
|
||||||
for mod in mods:
|
|
||||||
files[mod.filename] = open(os.path.join('mods', mod.filename), 'rb')
|
|
||||||
files[config_master.modpack_name + '.html'] = open(
|
|
||||||
config_master.modpack_name, 'rb')
|
|
||||||
|
|
||||||
res = requests.post(
|
|
||||||
url=config_master.remote_addr + '/post',
|
|
||||||
data=data,
|
|
||||||
files=files
|
|
||||||
)
|
|
||||||
res.raise_for_status()
|
|
||||||
|
|
||||||
for file in files.values():
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
print('Success!')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
@ -279,7 +250,7 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"action",
|
"action",
|
||||||
choices=["add", "add_all", "update", "update_all", "summary", "post"],
|
choices=["add", "add_all", "update", "update_all", "summary"],
|
||||||
help="What action to perform.",
|
help="What action to perform.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -313,5 +284,3 @@ if __name__ == "__main__":
|
||||||
update_mod_all(args.delete)
|
update_mod_all(args.delete)
|
||||||
elif args.action == "summary":
|
elif args.action == "summary":
|
||||||
generate_summary()
|
generate_summary()
|
||||||
elif args.action == "post":
|
|
||||||
post_pack()
|
|
||||||
|
|
|
@ -52,11 +52,8 @@ def post():
|
||||||
db.save('modpack.db')
|
db.save('modpack.db')
|
||||||
app.config.get('db_lock').release()
|
app.config.get('db_lock').release()
|
||||||
|
|
||||||
summary = request.files.get(config_server.modpack_name + '.html')
|
|
||||||
summary.save(config_server.modpack_name + '.html')
|
|
||||||
|
|
||||||
for fname, file in request.files.items():
|
for fname, file in request.files.items():
|
||||||
if not fname.endswith('.jar'):
|
if fname == 'modpack.db':
|
||||||
continue
|
continue
|
||||||
file.save(os.path.join(config_server.mods_dir, fname))
|
file.save(os.path.join(config_server.mods_dir, fname))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user