import os
from src.top import Top, InputMeta, OutputMeta


def test_build_csdn_ask_top10_tag_race():
    input = InputMeta(
        type='json_dir',
        path='data/csdn_ask_top10_month/',
        month_field='date',
        name_field='tag_name',
        count_field='count',
        audio=None
    )

    output = OutputMeta(
        path='pub/csdn_ask_top10_month',
        ext='gif',
        title='CSDN 问答标签月排行榜',
        x_label='ask.csdn.net',
        y_label='问题数',
        month_count=12
    )

    top = Top(input, output)
    top.build()


def test_build_csdn_trend_top10_tag_race():
    input = InputMeta(
        type='csv',
        path='data/csdn_trends_top10_month/csdn_index_top_10.csv',
        month_field='date',
        name_field='tag_name',
        count_field='index_value',
        audio='pub/mali.mp3'
    )

    output = OutputMeta(
        path='pub/csdn_trends_top10_month',
        ext='gif',
        title='CSDN topN指数月排行榜',
        x_label='csdn.net/trends',
        y_label='指数',
        month_count=None
    )

    top = Top(input, output)
    top.build()


if __name__ == "__main__":
    os.makedirs('pub', exist_ok=True)
    # test_build_csdn_ask_top10_tag_race()
    test_build_csdn_trend_top10_tag_race()
