blob: 4e4dad1b19640183c57a635e4198cf052b082781 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/python3
from requests import get
from os import listdir, remove
from shutil import rmtree, copyfileobj
INSTALL_DIR = ""
with open("pack-location.txt", "r") as f:
INSTALL_DIR = f.read().strip()
DOWNLOADS = []
NAMES = set()
FILES = listdir(INSTALL_DIR)
with open("downloads.txt", "r") as f:
for line in f:
dl = line.strip().split(" ")
if len(line) > 3 and len(dl) == 2 and line[0] != '#':
dl[0] = dl[0].strip()
dl[1] = dl[1].strip()
DOWNLOADS.append(dl)
NAMES.add(dl[0])
print("Updating pack...")
for mod in DOWNLOADS:
if mod[0] in FILES:
print("Skipping " + mod[0] + ", already up-to-date")
else:
print("Installing " + mod[0] + " from " + mod[1] + "...")
download_obj = get(mod[1], stream=True)
with open(INSTALL_DIR + "/" + mod[0], "wb") as write_file:
copyfileobj(download_obj.raw, write_file)
print("Done!")
print("\nRemoving old versions...")
for jar in FILES:
if jar not in NAMES and jar[-4:] == ".jar":
remove(INSTALL_DIR + "/" + jar)
print("Removing '" + jar + "'")
print("\nFinished updating pack!")
|