check if file extension is .apk (to prevent that .part) files are moved into repo folder. If not, wait for 30 seconds to finish the download and try again.
This commit is contained in:
Manuel Kamper 2024-01-12 17:25:46 +00:00
parent 4dab116773
commit 6a28e38c29

View File

@ -1,4 +1,4 @@
#APK Updater v1.2
#APK Updater v1.3
#(C) 2024 by Manuel Kamper (kmpr.at)
#Do not remove copyright when distributing!
import feedparser, mysql.connector, os, glob, time, shutil
@ -19,7 +19,7 @@ mydb = mysql.connector.connect(
database="appstore"
)
### NO EDITS BELOW NECESSARY ###
### NO EDITS BELOW HERE NECESSARY ###
url = "https://apkcombo.com/latest-updates/feed"
@ -27,6 +27,8 @@ def get_last_filename_and_rename(new_filename):
global temp_path, repo_path
files = glob.glob(temp_path + '/*')
max_file = max(files, key=os.path.getctime)
while not max_file.endswith(".apk"):
time.sleep(30)
filename_stripped = max_file.replace("_apkcombo.com","")
filename = filename_stripped.split("/")[-1].split("_")[-2]
new_filename2 = max_file.replace(filename, new_filename)