def get_log(line):
    try:
        line = int(line)
    except ValueError:
        return get_error_response('line must be a int number: %s' % line).format()
    if not line:
        line = 0
    l = download_queue.get_log_from(int(line))
    return ResponseBody(log=l).format()
def get_vcode_status():
    return ResponseBody(
        need_input=False if not vcode.temp_driver else True,
        type=vcode.vcode_type
    ).format()
def get_wxid_list():
    subscribes = sqlite_helper.get_wxid_list()
    return ResponseBody(wxid_list=subscribes).format()
def get_date_by_written():
    return ResponseBody(date=sqlite_helper.get_date_by_written()).format()
def get_date_by_created():
    return ResponseBody(date=sqlite_helper.get_date_by_created()).format()
def get_articles_by_author(author):
    articles = sqlite_helper.get_articles_by_author(author)
    return ResponseBody(articles=articles).format()
def get_articles_by_date_created(date):
    if not common.valid_date_string(date):
        return get_error_response('%s is not a date' % date).format()
    articles = sqlite_helper.get_articles_by_date_created(date)
    return ResponseBody(articles=articles).format()
def progress():
    if download_queue.get_status() == constants.BUSY:
        p = download_queue.get_thread_progress()
        return ResponseBody(**p).format()
    if download_queue.get_status() == constants.IDLE:
        return ResponseBody(total=0, progress=-1, sub_task_total=0, sub_task_progress=-1).format()
def get_status():
    return ResponseBody(1, download_queue.get_status()).format()