Beispiel #1
0
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
Beispiel #3
0
def update_app_developer():
    index = 0
    date = utils.getdate()
    devsList = db.get_specail_devslist(date)
    print "update_app_developer dev len=", devsList.__len__()
    for dev in devsList:
        app = db.search_appinfo(dev.package)
        if app is not None:
            db.update_devinfo(dev.company, utils.getdate(), dev.status,
                              app.package, app.company, app.company_link)
            if cmp(dev.company, app.company) != 0:
                print "update dev:", index, dev.company, app.package
            index += 1
Beispiel #4
0
def write_app_developer(row):
    global cc
    cc += 1
    company_link = row[0]
    date = row[1]
    company = row[2]
    status = row[3]
    id = row[4]

    i = CompanyDetail(company, company_link, date, status, "", id)

    company = db.search_developer(i.company, "xxxxx")
    if company is not None and cc == 2:
        pass
        print "upate dev:", cc, i.status, company.package, i.date, company.company, company.company_link
        db.update_devinfo(i.company, i.date, i.status, company.package,
                          company.company, company.company_link)
Beispiel #5
0
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
Beispiel #6
0
def check_new_developer():
    index = 0
    date = utils.getdate()
    appsList = db.get_specail_new_appslist(date)
    print "check_new_developer app new len=", len(appsList)
    for app in appsList:
        dev = db.search_developer(app.company, app.package)
        needupdate = 0
        if dev is None:
            dev = db.search_developer_pkg(app.package)
            if dev is None:
                db.write_developer(app.company, app.company_link, date,
                                   app.package)
                print "insert:", index, app.company, app.company_link, app.package
                needupdate += 1
        if needupdate == 0:
            db.update_devinfo(dev.company, utils.getdate(), dev.status,
                              app.package, app.company, app.company_link)
            #print dev.company, app.package
            pass

        index = index + 1
Beispiel #7
0
def test_update_dev():
    app = db.search_appinfo("com.mfa.filemanager")
    db.update_devinfo(app.company, app.date, "ok", app.package, app.company, app.company_link)
    db.update_devinfo_company_pkg(app.company, app.date, app.package)
    db.update_devinfo_simple(app.company, app.date, "ok", app.package)