def initdata(): cat1 = Movcat("dongzhuo", "分类1") mv1 = Mov() mv1.title = "title1" mv1.banben = "banben1" mv1.arts = "arts1" mv1.dc = "dc1" mv1.lang = "lang1" mv1.location = "location1" mv1.pubdate = "pubdate1" mv1.statue = "status1" mv1.content = "content1" mv1.img = "img1" mv1.fromto = "hakuzy" mv1.category = cat1 mv2 = Mov() mv2.title = "title2" mv2.banben = "banben2" mv2.arts = "arts2" mv2.dc = "dc2" mv2.lang = "lang2" mv2.location = "location2" mv2.pubdate = "pubdate2" mv2.statue = "status2" mv2.content = "content2" mv2.img = "img2" mv2.fromto = "hakuzy" mv2.category = cat1 md1 = Movdetail() md1.tp = 1 md1.url = "url1" md1.movie = mv1 md2 = Movdetail() md2.tp = 1 md2.url = "url2" md2.movie = mv1 md3 = Movdetail() md3.tp = 1 md3.url = "url1" md3.movie = mv2 db.session.add(cat1) db.session.add(mv1) db.session.add(mv2) db.session.add(md1) db.session.add(md2) db.session.add(md3) db.session.commit() return "init data ok"
def hakuzyUpToMov(id): _mv = HakuzyMovie.query.get(id) _url = "http://www.hakuzy.com" + _mv.url myutils = Utils() list = myutils.fetchHakuzyDetail(_url) #list = [_title,_banben,_arts,_dc,_category,_lang,_location,_pubdate,_status,_year,_content] mv= Mov() mv.title = list[0] mv.banben = list[1] mv.arts = list[2] mv.dc = list[3] mv.catestr = list[4] mv.lang = list[5] mv.location = list[6] mv.pubdate = list[7] mv.status = list[8] mv.year = list[9] mv.content = list[10] mv.fromto = 'hakuzy' db.session.add(mv) db.session.commit() return "http://www.hakuzy.com" + _mv.url
def hakuzyUpToMov(id): _mv = HakuzyMovie.query.get(id) _url = "http://www.hakuzy.com" + _mv.url myutils = Utils() list = myutils.fetchHakuzyDetail(_url) #list = [_title,_banben,_arts,_dc,_category,_lang,_location,_pubdate,_status,_year,_content] mv = Mov() mv.title = list[0] mv.banben = list[1] mv.arts = list[2] mv.dc = list[3] mv.catestr = list[4] mv.lang = list[5] mv.location = list[6] mv.pubdate = list[7] mv.status = list[8] mv.year = list[9] mv.content = list[10] mv.fromto = 'hakuzy' db.session.add(mv) db.session.commit() return "http://www.hakuzy.com" + _mv.url
def initdata(): cat1 = Movcat("dongzhuo","分类1") mv1 = Mov() mv1.title = "title1" mv1.banben = "banben1" mv1.arts = "arts1" mv1.dc = "dc1" mv1.lang = "lang1" mv1.location = "location1" mv1.pubdate = "pubdate1" mv1.statue = "status1" mv1.content = "content1" mv1.img = "img1" mv1.fromto = "hakuzy" mv1.category = cat1 mv2 = Mov() mv2.title = "title2" mv2.banben = "banben2" mv2.arts = "arts2" mv2.dc = "dc2" mv2.lang = "lang2" mv2.location = "location2" mv2.pubdate = "pubdate2" mv2.statue = "status2" mv2.content = "content2" mv2.img = "img2" mv2.fromto = "hakuzy" mv2.category = cat1 md1 = Movdetail() md1.tp = 1 md1.url = "url1" md1.movie = mv1 md2 = Movdetail() md2.tp = 1 md2.url = "url2" md2.movie = mv1 md3 = Movdetail() md3.tp = 1 md3.url = "url1" md3.movie = mv2 db.session.add(cat1) db.session.add(mv1) db.session.add(mv2) db.session.add(md1) db.session.add(md2) db.session.add(md3) db.session.commit() return "init data ok"