Added normal self-updation
This commit is contained in:
@@ -8,10 +8,12 @@ import json
|
|||||||
launchfolder = os.getcwd()
|
launchfolder = os.getcwd()
|
||||||
offprojects = launchfolder + "/OfficialProjects/"
|
offprojects = launchfolder + "/OfficialProjects/"
|
||||||
launcherfiles = offprojects + "/LAUNCHERFILES/"
|
launcherfiles = offprojects + "/LAUNCHERFILES/"
|
||||||
launchergithuburl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/KOTIKOT_launcher.py"
|
launcherurl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/KOTIKOT_launcher.py"
|
||||||
launcherguigithuburl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/KOTIKOTlauncherMain.py"
|
guiurl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/KOTIKOTlauncherMain.py"
|
||||||
launcherremindergithuburl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/KOTIKOTlauncherReminder.py"
|
reminderurl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/KOTIKOTlauncherReminder.py"
|
||||||
launchersettingsgithuburl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/KOTIKOTlauncherSettings.py"
|
settingsurl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/KOTIKOTlauncherSettings.py"
|
||||||
|
launcherversionurl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/v"
|
||||||
|
appslisturl = "https://raw.githubusercontent.com/BarsTiger/KOTIKOTapps_download_repo/master/OfficialProjects/LAUNCHERFILES/apps.json"
|
||||||
|
|
||||||
|
|
||||||
# ---------------- Checking folders ----------------
|
# ---------------- Checking folders ----------------
|
||||||
@@ -23,10 +25,16 @@ if not os.path.exists(launcherfiles):
|
|||||||
|
|
||||||
# ---------------- Self-updataing launcher ----------------
|
# ---------------- Self-updataing launcher ----------------
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
urllib.request.urlretrieve(launchergithuburl, "KOTIKOT_launcher.py")
|
urllib.request.urlretrieve(appslisturl, launcherfiles + "apps.json")
|
||||||
urllib.request.urlretrieve(launcherguigithuburl, launcherfiles + "KOTIKOTlauncherMain.py")
|
|
||||||
urllib.request.urlretrieve(launcherremindergithuburl, launcherfiles + "KOTIKOTlauncherReminder.py")
|
with open(launcherfiles + "/v") as v_file:
|
||||||
urllib.request.urlretrieve(launchersettingsgithuburl, launcherfiles + "KOTIKOTlauncherSettings.py")
|
v = int(v_file.read())
|
||||||
|
if v < int(requests.get(launcherversionurl).text):
|
||||||
|
urllib.request.urlretrieve(launcherurl, "KOTIKOT_launcher.py")
|
||||||
|
urllib.request.urlretrieve(guiurl, launcherfiles + "KOTIKOTlauncherMain.py")
|
||||||
|
urllib.request.urlretrieve(reminderurl, launcherfiles + "KOTIKOTlauncherReminder.py")
|
||||||
|
urllib.request.urlretrieve(settingsurl, launcherfiles + "KOTIKOTlauncherSettings.py")
|
||||||
|
urllib.request.urlretrieve(launcherversionurl, launcherfiles + "v")
|
||||||
|
|
||||||
|
|
||||||
# ---------------- Launching GUI ----------------
|
# ---------------- Launching GUI ----------------
|
||||||
@@ -63,34 +71,31 @@ def download_app(app):
|
|||||||
|
|
||||||
|
|
||||||
def launchApp():
|
def launchApp():
|
||||||
try:
|
with open("OfficialProjects/LAUNCHERFILES/apps.json") as appsfile:
|
||||||
with open("OfficialProjects/LAUNCHERFILES/apps.json") as appsfile:
|
apps = json.load(appsfile)
|
||||||
apps = json.load(appsfile)
|
name = KOTIKOTlauncher.sender().text()
|
||||||
name = KOTIKOTlauncher.sender().text()
|
app = apps[name]
|
||||||
app = apps[name]
|
directory = offprojects + app['dir']
|
||||||
directory = offprojects + app['dir']
|
|
||||||
|
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
os.mkdir(directory)
|
os.mkdir(directory)
|
||||||
|
download_app(app)
|
||||||
|
|
||||||
|
else:
|
||||||
|
with open(directory + "/v") as v_file:
|
||||||
|
v = int(v_file.read())
|
||||||
|
if v < int(requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text):
|
||||||
|
print('Current app version is ' + str(v) + ' and new version is '
|
||||||
|
+ requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text)
|
||||||
|
print('Updating...')
|
||||||
download_app(app)
|
download_app(app)
|
||||||
|
urllib.request.urlretrieve('/'.join(app['urls'][0].split('/')[:-1]) + '/v',
|
||||||
|
offprojects + app['dir'] + "/v")
|
||||||
|
|
||||||
else:
|
displayName = name.replace('\n', '')
|
||||||
with open(directory + "/v") as v_file:
|
print(f"---------------- {displayName} ----------------")
|
||||||
v = int(v_file.read())
|
subprocess.Popen(str(sys.executable + " " if app['runtime'] == "python" else "") + app['run'], cwd=directory,
|
||||||
if v < int(requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text):
|
shell=True, close_fds=True)
|
||||||
print('Current app version is ' + str(v) + ' and new version is '
|
|
||||||
+ requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text)
|
|
||||||
print('Updating...')
|
|
||||||
download_app(app)
|
|
||||||
urllib.request.urlretrieve('/'.join(app['urls'][0].split('/')[:-1]) + '/v',
|
|
||||||
offprojects + app['dir'] + "/v")
|
|
||||||
|
|
||||||
displayName = name.replace('\n', '')
|
|
||||||
print(f"---------------- {displayName} ----------------")
|
|
||||||
subprocess.Popen(str(sys.executable + " " if app['runtime'] == "python" else "") + app['run'], cwd=directory,
|
|
||||||
shell=True, close_fds=True)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- Checking buttons ----------------
|
# ---------------- Checking buttons ----------------
|
||||||
|
|||||||
1
OfficialProjects/LAUNCHERFILES/v
Normal file
1
OfficialProjects/LAUNCHERFILES/v
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0
|
||||||
Reference in New Issue
Block a user