def GET(self): username = web.input().get('u') if username: #搜索自动处理的feed(字符串http开头) feeds = [] #搜索手动处理的feed mfeeds = [] ownfeeds = model.username2feeds(username) if len(ownfeeds) != 0: #取feeds信息 books = (model.get_allbooks()) for book in books: if book.f_id in ownfeeds: b=[] if cmp('http',book.url[0:4].lower()) == 0: b.append(book.title) b.append(book.url) if book.isfulltext == 1: b.append(True) else: b.append(False) feeds.append(b) else: b.append(book.url) mfeeds.append(b) #取用户信息 user = model.getuser(username)[0] #加入eq if user and user.kindle_email: jobq.enqueue(pushwork,user.kindle_email,feeds,mfeeds,user.keep_image) return jjenv.get_template("autoback.html").render(nickname=session.username,title='Delivering',tips='books put to queue!')
def GET(self): username = web.input().get('u') adminpush = web.input().get('p') if username and adminpush != None: #用于管理员测试 #搜索自动处理的feed(字符串http开头) feeds = [] #搜索手动处理的feed mfeeds = [] feeds_num = 0 ownfeeds = model.username2feeds(username) if len(ownfeeds) != 0: ''' #取feeds信息 books = (model.get_allbooks()) for book in books: if book.f_id in ownfeeds: b=[] if cmp('http',book.url[0:4].lower()) == 0: b.append(book.title) b.append(book.url) if book.isfulltext == 1: b.append(True) else: b.append(False) feeds.append(b) else: b.append(book.url) mfeeds.append(b) feeds_num += 1 #取用户信息 user = model.getuser(username)[0] #加入eq if user and user.kindle_email: jobq.enqueue(pushwork,args=(user.kindle_email,feeds,mfeeds,user.keep_image),timeout=feeds_num*300) ''' user = model.getuser(username)[0] if user and user.kindle_email: jobq.enqueue(pushwork3, args=(user.kindle_email, ownfeeds, user.keep_image, user.ifmobi)) return jjenv.get_template("autoback.html").render( nickname=session.username, title='Delivering', tips='admin已投递!') else: user = model.getuser(username)[0] if user and user.kindle_email: ROOT = path.dirname(path.abspath(__file__)) output_dir = path.join(ROOT, 'templates2') mobi_file = path.join(output_dir, 'WelcomeRedKindle.mobi') jobq.enqueue(send_mail, args=(SrcEmail, user.kindle_email, mobi_file, 1)) return jjenv.get_template("autoback.html").render( nickname=session.username, title='Delivering', tips='已投递!')
def GET(self): username = web.input().get('u') adminpush = web.input().get('p') if username and adminpush != None:#用于管理员测试 #搜索自动处理的feed(字符串http开头) feeds = [] #搜索手动处理的feed mfeeds = [] feeds_num = 0 ownfeeds = model.username2feeds(username) if len(ownfeeds) != 0: ''' #取feeds信息 books = (model.get_allbooks()) for book in books: if book.f_id in ownfeeds: b=[] if cmp('http',book.url[0:4].lower()) == 0: b.append(book.title) b.append(book.url) if book.isfulltext == 1: b.append(True) else: b.append(False) feeds.append(b) else: b.append(book.url) mfeeds.append(b) feeds_num += 1 #取用户信息 user = model.getuser(username)[0] #加入eq if user and user.kindle_email: jobq.enqueue(pushwork,args=(user.kindle_email,feeds,mfeeds,user.keep_image),timeout=feeds_num*300) ''' user = model.getuser(username)[0] if user and user.kindle_email: jobq.enqueue(pushwork3,args=(user.kindle_email,ownfeeds,user.keep_image,user.ifmobi)) return jjenv.get_template("autoback.html").render(nickname=session.username,title='Delivering',tips='admin已投递!') else: user = model.getuser(username)[0] if user and user.kindle_email: ROOT = path.dirname(path.abspath(__file__)) output_dir = path.join(ROOT, 'templates2') mobi_file = path.join(output_dir,'WelcomeRedKindle.mobi') jobq.enqueue(send_mail,args=(SrcEmail,user.kindle_email,mobi_file,1)) return jjenv.get_template("autoback.html").render(nickname=session.username,title='Delivering',tips='已投递!')
hour = date.hour tz2 = pytz.timezone('Asia/Shanghai') date2 = datetime.now(tz2) weekday = date2.isoweekday()#Mon 1: Sun 7 users = model.get_current_push_users(hour,weekday) if len(users) == 0: print '-=end=-' else: #推送 for user in users: feeds = [] mfeeds = [] feeds_num = 0 ownfeeds = model.username2feeds(user.name) if len(ownfeeds) != 0: ''' books = (model.get_allbooks()) for book in books: if book.f_id in ownfeeds: b=[] if cmp('http',book.url[0:4].lower()) == 0: #自动的feeds b.append(book.title) b.append(book.url) if book.isfulltext == 1: b.append(True) else: b.append(False) feeds.append(b)
hour = date.hour tz2 = pytz.timezone('Asia/Shanghai') date2 = datetime.now(tz2) weekday = date2.isoweekday() #Mon 1: Sun 7 users = model.get_current_push_users(hour, weekday) if len(users) == 0: print '-=end=-' else: #推送 for user in users: feeds = [] mfeeds = [] feeds_num = 0 ownfeeds = model.username2feeds(user.name) if len(ownfeeds) != 0: ''' books = (model.get_allbooks()) for book in books: if book.f_id in ownfeeds: b=[] if cmp('http',book.url[0:4].lower()) == 0: #自动的feeds b.append(book.title) b.append(book.url) if book.isfulltext == 1: b.append(True) else: b.append(False) feeds.append(b)