Changed version update logik
This commit is contained in:
parent
9bcbc81c2f
commit
127d16afea
12
V6.py
12
V6.py
|
@ -642,19 +642,23 @@ def fidelity():
|
|||
pause = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]')
|
||||
pause.click()
|
||||
except Exception as e:
|
||||
error(f"Error while clicking pause. Probably no cards. {e}")
|
||||
return "no cards"
|
||||
debug("No pause button.")
|
||||
|
||||
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||
nb_cartes = len(cartes)
|
||||
if nb_cartes == 0:
|
||||
warning("No fidelity cards detected")
|
||||
return "No cards."
|
||||
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
|
||||
for i in range(nb_cartes):
|
||||
cartes[i].click()
|
||||
checked_txt = checked_list_all[i].get_attribute("innerHTML")
|
||||
ok = checked_txt.count("StatusCircleOuter checkmark")
|
||||
total = checked_txt.count("StatusCircleOuter")
|
||||
if (ok != total):
|
||||
if ok != total:
|
||||
elm = driver.find_elements(By.CLASS_NAME, 'clickable-link')[i]
|
||||
if not "moviesandtv" in elm.get_attribute("innerHTML"): # not the film card
|
||||
# legacy code. Should be removed
|
||||
if "moviesandtv" not in elm.get_attribute("innerHTML"): # not the film card
|
||||
elm.click()
|
||||
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
|
||||
sub_fidelity()
|
||||
|
|
|
@ -22,7 +22,8 @@ class Config:
|
|||
proxy = json.load(inFile)
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
config = json.load(inFile)
|
||||
|
||||
with open("/app/MsRewards-reborn/user_data/version", "r") as inFile:
|
||||
version = inFile.readline()
|
||||
"""
|
||||
setup standalone stuff
|
||||
"""
|
||||
|
@ -34,7 +35,7 @@ class Config:
|
|||
self.version = args.update_version
|
||||
self.WebDriver = Driver()
|
||||
self.display = None
|
||||
|
||||
self.version = version
|
||||
"""
|
||||
setup UserCredential
|
||||
"""
|
||||
|
@ -52,11 +53,11 @@ class Config:
|
|||
self.discord.avatar_url = settings["avatarlink"]
|
||||
|
||||
if (
|
||||
"discord" in config[args.config]
|
||||
and config[args.config]["discord"] in discord
|
||||
and "errorsL" in discord[config[args.config]["discord"]]
|
||||
and discord[config[args.config]["discord"]]["errorsL"] != ""
|
||||
):
|
||||
"discord" in config[args.config]
|
||||
and config[args.config]["discord"] in discord
|
||||
and "errorsL" in discord[config[args.config]["discord"]]
|
||||
and discord[config[args.config]["discord"]]["errorsL"] != ""
|
||||
):
|
||||
self.discord.wh_link = discord[config[args.config]["discord"]]["errorsL"]
|
||||
self.discord.wh = Webhook.from_url(self.discord.wh_link, adapter=RequestsWebhookAdapter())
|
||||
else:
|
||||
|
@ -81,4 +82,10 @@ class Config:
|
|||
self.display = display
|
||||
|
||||
def has_been_updated(self):
|
||||
return self.version != "None"
|
||||
with open('/app/MsRewards-Reborn/version', "r") as inFile:
|
||||
if self.version != inFile.readline():
|
||||
self.version = inFile.readline()
|
||||
with open('/app/MsRewards-Reborn/user_data/version', "w") as outFile:
|
||||
outFile.write(self.version)
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
0.0.0
|
Loading…
Reference in New Issue