added activity check
This commit is contained in:
parent
ae392a7f64
commit
f818ae6c4a
19
Main.py
19
Main.py
@ -7,6 +7,7 @@ import io
|
|||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
instance_name = "Familycraft Season 7"
|
instance_name = "Familycraft Season 7"
|
||||||
@ -23,17 +24,27 @@ def main():
|
|||||||
versions = json.load(bio)
|
versions = json.load(bio)
|
||||||
bio.close()
|
bio.close()
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
if os.path.exists(prism_instance_path+"/"+instance_name+"/version.txt"):
|
if os.path.exists(prism_instance_path+"/"+instance_name+"/.minecraft/version.txt"):
|
||||||
with open(prism_instance_path+"/"+instance_name+"/version.txt", 'r') as fp:
|
with open(prism_instance_path+"/"+instance_name+"/.minecraft/version.txt", 'r') as fp:
|
||||||
version = fp.readline()
|
version = fp.readline().rstrip()
|
||||||
if version != versions[len(versions)-1]["Version"]:
|
if version != versions[len(versions)-1]["Version"]:
|
||||||
#version = versions[len(versions)-1]["Version"]
|
#version = versions[len(versions)-1]["Version"]
|
||||||
# Update Modpack
|
# Update Modpack
|
||||||
|
print(version)
|
||||||
|
print(versions[len(versions)-1]["Version"])
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
modpack = open(os.path.join(temp_dir, instance_name+".mrpack"), 'wb')
|
modpack = open(os.path.join(temp_dir, instance_name+".mrpack"), 'wb')
|
||||||
ftp.retrbinary("RETR "+versions[len(versions)-1]["File"], modpack.write)
|
ftp.retrbinary("RETR "+versions[len(versions)-1]["File"], modpack.write)
|
||||||
modpack.close()
|
modpack.close()
|
||||||
subprocess.run([prism_command, '-I', modpack.name])
|
p = subprocess.Popen([prism_command, '-I', modpack.name])
|
||||||
|
while True:
|
||||||
|
time.sleep(5)
|
||||||
|
if os.path.exists(prism_instance_path+"/"+instance_name+"/.minecraft/version.txt"):
|
||||||
|
with open(prism_instance_path+"/"+instance_name+"/.minecraft/version.txt", 'r') as fp:
|
||||||
|
version = fp.readline().rstrip()
|
||||||
|
if version == versions[len(versions)-1]["Version"]:
|
||||||
|
break;
|
||||||
|
|
||||||
#with open(prism_instance_path+"/"+instance_name+"/version.txt", 'w') as fp:
|
#with open(prism_instance_path+"/"+instance_name+"/version.txt", 'w') as fp:
|
||||||
# fp.seek(0)
|
# fp.seek(0)
|
||||||
# fp.truncate()
|
# fp.truncate()
|
||||||
|
Loading…
Reference in New Issue
Block a user