コード例 #1
0
ファイル: getnovel.py プロジェクト: yudahai/xiaoshuo01
def update_infor():
    """
    #更新novel小说信息,比如:最近更新时间,字数,推荐数
    """
    threads = []
    urls = db_session.query(Novel.source_url).all()
    for url in urls:
        threads.append(threading.Thread(target=update_single_infor, args=(url[0],)))
    produce_consume(threads, 50)
コード例 #2
0
ファイル: getnovel.py プロジェクト: yudahai/xiaoshuo01
def update_chapter_infor():
    """
    根据novel_content_url更新chapter表的 url和 name 信息
    """
    threads = []
    novel_content_id_urls = db_session.query(Novel.id, Novel.source_url).filter(Novel.source_url is not None).all()
    for novel_id, url in novel_content_id_urls:
        threads.append(threading.Thread(target=update_single_chapter_infor, args=(novel_id, url)))

    produce_consume(threads, 5)
コード例 #3
0
ファイル: getnovel.py プロジェクト: yudahai/xiaoshuo01
def update_chapter_content(novel_id):
    threads = []
    chapter_content_empty_items = (
        db_session.query(Chapter.id, Chapter.url)
        .filter(and_(Chapter.novel_id == novel_id, Chapter.content_source == 2, Chapter.content == None))
        .all()
    )
    for chapter_id, chapter_url in chapter_content_empty_items:
        threads.append(threading.Thread(target=update_single_chapter_content, args=(chapter_url, chapter_id)))
    produce_consume(threads=threads, MAX_THREADS=5)
コード例 #4
0
def update_novel_infor():
    threads = []
    for x in range(1, 440):
        threads.append(threading.Thread(target=_update_single_novel_infor, args=(x, )))

    produce_consume(threads, 2)