def save_app_to_list(appslist): cc = 0 date = utils.getdate() #if len(appslist) > 0: # print appslist[0].category for i in appslist: i.package = utils.get_package(i.link) app = db.search_partappinfo(i.package) dev = db.search_developer(i.company, i.package) cc += 1 if dev is None: #maybe this package is not relative with dev. pass else: db.update_devinfo(dev.company, date, dev.status, i.package, i.company, i.company_link) #if dev is not None and cmp(dev.date, date) != 0: # print "update dev:", i.company, i.company_link, dev.date, date if app is None: db.write_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) else: i.date = date db.check_append_appchangelog_info(i, app) db.update_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small)
def collect_all_apps(): urlGen = UrlGen() allCategories = urlGen.get_test_categories() appsList = parseapp.parse_all_apps(allCategories, None) cc = 0 for i in appsList: i.package = utils.get_package(i.link) app = db.search_partappinfo(i.package) dev = db.search_developer(i.company, i.package) cc = cc + 1 if dev is None: #maybe this package is not relative with dev. pass else: db.update_devinfo(dev.company, utils.getdate(), dev.status, i.package, i.company, i.company_link) #print i.package if app is None: db.write_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) else: i.date = utils.getdate() db.check_append_appchangelog_info(i, app) db.update_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) return appsList
def write_app_changelog(row): global cc i = AppDetail() i.rank = row[0] i.title = row[1] #i.link = row[2] i.package = row[2] i.company = row[3] i.desc = row[4] i.date = row[5] i.category = row[6] cc += 1 date = utils.getdate() app = db.search_partappinfo(i.package) if app is not None and cc == 1: i.link = app.link i.company_link = app.company_link if i.title.find("new!!") != -1 or i.company.find( "new!!") != -1 or i.desc.find("new!!") != -1: db.write_appchangelogInfo_ex(i) print "update appchangelog :", cc, i.title, i.package, i.company, i.desc
def write_app(row): global cc i = AppDetail() i.rank = row[0] i.title = row[1] i.link = row[2] i.package = row[3] i.company = row[4] i.company_link = row[5] i.desc = row[6] i.date = row[7] i.category = row[8] i.icon = row[9] i.icon_small = row[10] date = utils.getdate() app = db.search_partappinfo(i.package) dev = db.search_developer(i.company, i.package) cc += 1 if dev is None: #maybe this package is not relative with dev. pass else: db.update_devinfo(dev.company, date, dev.status, i.package, i.company, i.company_link) if app is None: db.write_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) ''' else: db.check_append_appchangelog_info(i, app) db.update_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) ''' print "write app:", cc, i.title, i.package