def checkEbay(sendNum): mySendList = [] ebaySend = False database.init() d = database.dictfetchone("SELECT * FROM bulk.sends WHERE id = %s", sendNum) if not d: print "FATAL ERROR: Send %s does not exist\n" % sendNum sys.exit(1) if d['cancelled']: print "Send %s has already been cancelled\n" % sendNum sys.exit(1) if not(d['future']) and not(args.FORCE): print "Send %s is already done or is currently sending, use -F to override this check\n" % sendNum sys.exit(1) else: i = "%(cmd)s" % d mySendList = i.split(' ') for item in mySendList: if item == "ebay": ebaySend = True break; if ebaySend: return True else: return False
def getSendTime(sendNum): database.init() sendTime = "" d = database.dictfetchone("SELECT * FROM bulk.sends WHERE id = %s", sendNum) sendTime = datetime.fromtimestamp(d['when']) compareTime = int(sendTime.strftime('%s')) currentTime = int(datetime.now().strftime('%s')) if compareTime < currentTime: print "Error: sendTime %s is in the past. Scheduling for 15minutes in the future.\n" % datetime.fromtimestamp(compareTime).strftime('%H:%M %m/%d/%Y') sendTime = currentTime + 900 else: sendTime = compareTime print "Your send time is: %s\n" % datetime.fromtimestamp(sendTime).strftime('%H:%M %m/%d/%Y') return datetime.fromtimestamp(sendTime).strftime('%H:%M %m/%d/%Y')