forked from piair/MsRewards-Reborn
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 = driver.find_element(By.CSS_SELECTOR, f'[class="c-action-toggle c-glyph f-toggle glyph-pause"]')
|
||||||
pause.click()
|
pause.click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error(f"Error while clicking pause. Probably no cards. {e}")
|
debug("No pause button.")
|
||||||
return "no cards"
|
|
||||||
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
cartes = driver.find_elements(By.CSS_SELECTOR, f'[ng-repeat="item in $ctrl.transcludedItems"]')
|
||||||
nb_cartes = len(cartes)
|
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"]')
|
checked_list_all = driver.find_elements(By.CSS_SELECTOR, f'[ng-if="$ctrl.complete"]')
|
||||||
for i in range(nb_cartes):
|
for i in range(nb_cartes):
|
||||||
cartes[i].click()
|
cartes[i].click()
|
||||||
checked_txt = checked_list_all[i].get_attribute("innerHTML")
|
checked_txt = checked_list_all[i].get_attribute("innerHTML")
|
||||||
ok = checked_txt.count("StatusCircleOuter checkmark")
|
ok = checked_txt.count("StatusCircleOuter checkmark")
|
||||||
total = checked_txt.count("StatusCircleOuter")
|
total = checked_txt.count("StatusCircleOuter")
|
||||||
if (ok != total):
|
if ok != total:
|
||||||
elm = driver.find_elements(By.CLASS_NAME, 'clickable-link')[i]
|
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()
|
elm.click()
|
||||||
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
|
driver.switch_to.window(driver.window_handles[len(driver.window_handles) - 1])
|
||||||
sub_fidelity()
|
sub_fidelity()
|
||||||
|
@ -22,7 +22,8 @@ class Config:
|
|||||||
proxy = json.load(inFile)
|
proxy = json.load(inFile)
|
||||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||||
config = json.load(inFile)
|
config = json.load(inFile)
|
||||||
|
with open("/app/MsRewards-reborn/user_data/version", "r") as inFile:
|
||||||
|
version = inFile.readline()
|
||||||
"""
|
"""
|
||||||
setup standalone stuff
|
setup standalone stuff
|
||||||
"""
|
"""
|
||||||
@ -34,7 +35,7 @@ class Config:
|
|||||||
self.version = args.update_version
|
self.version = args.update_version
|
||||||
self.WebDriver = Driver()
|
self.WebDriver = Driver()
|
||||||
self.display = None
|
self.display = None
|
||||||
|
self.version = version
|
||||||
"""
|
"""
|
||||||
setup UserCredential
|
setup UserCredential
|
||||||
"""
|
"""
|
||||||
@ -81,4 +82,10 @@ class Config:
|
|||||||
self.display = display
|
self.display = display
|
||||||
|
|
||||||
def has_been_updated(self):
|
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
|
||||||
|
1
user_data/version
Normal file
1
user_data/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.0.0
|
Loading…
Reference in New Issue
Block a user