Created
December 26, 2022 15:43
-
-
Save webserveis/77d785461d396e9219508b2e41e0195b to your computer and use it in GitHub Desktop.
GPlay Tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
from datetime import date | |
class AppGplay: | |
def __init__(self, name, startDate, endDate=None): | |
self.name = name | |
self.startDate = startDate | |
if endDate is None: | |
endDate = self.startDate + timedelta(days=7) | |
self.endDate = endDate | |
self.nextPromo = endDate + timedelta(days=30) | |
class bcolors: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' | |
OKCYAN = '\033[96m' | |
OKGREEN = '\033[92m' | |
WARNING = '\033[93m' | |
FAIL = '\033[91m' | |
ENDC = '\033[0m' | |
BOLD = '\033[1m' | |
UNDERLINE = '\033[4m' | |
#====================== add Apps in list | |
list = [] | |
list.append(AppGplay('App default manager', date(2022,11,27))) | |
list.append(AppGplay('Http redirection', date(2022,12,25))) | |
list.append(AppGplay('App Manager', date(2021,12,31))) | |
list.append(AppGplay('MQTT Presence', date(2022,6,24))) | |
#================== Main App ================ | |
date_format = '%Y-%m-%d' | |
today = date.today() | |
print(bcolors.HEADER + "App Sales v1.0.0" + bcolors.ENDC) | |
print('today is: ', today) | |
for row in list: | |
print('----------------------------------------------') | |
inPromo = False | |
if row.startDate <= today <= row.endDate: | |
inPromo = True | |
promoAvailabe = False | |
if row.nextPromo <= today: | |
promoAvailabe = True | |
if (inPromo): | |
delta = row.endDate - today | |
endDate = row.endDate.strftime(date_format) + ' ' + bcolors.WARNING + str(delta.days) + " days left" + bcolors.ENDC | |
else: | |
endDate = row.endDate.strftime(date_format) | |
delta = row.nextPromo - today | |
if (promoAvailabe): | |
nextPromo = row.nextPromo.strftime(date_format) + bcolors.OKGREEN + " can be promoted" + bcolors.ENDC | |
else: | |
nextPromo = row.nextPromo.strftime(date_format) + " " + bcolors.FAIL + str(delta.days) + " days left" + bcolors.ENDC | |
displayName = bcolors.OKCYAN + row.name + bcolors.ENDC | |
print("app: ", displayName) | |
print("start date: ", row.startDate.strftime(date_format)) | |
print("end date: ", endDate) | |
print("next promo: ", nextPromo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GPlay Tools | |
Set de scripts en python para promocionar aplicacones en google play |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment