
import './index.less'
import React from "react";
import axios from 'axios';

export const Srt: React.FC = (props: any) => {
    //解析时间
    const parseSrtTime = function (str: string): number {
        var str0 = str.split(':')[0]
        var str1 = str.split(':')[1]
        var str2 = str.split(':')[2].replace(",", "")

        return Number(str0) * 3600000 + Number(str1) * 60000 + Number(str2)
    }
    axios({
        url:'./7月12日.srt',
        responseType:'text'
        

    }).then(res=>{
        // console.log(res.data)
        var srtArr = res.data.split('\n') as string[]
        var srtParseArr:string[][] = []
        var a =0
        srtArr.pop()
 
        while (a < srtArr.length) {
            srtParseArr.push([srtArr[a], srtArr[a + 1], srtArr[a + 2], srtArr[a + 3]])
            a = a + 4
        }
        console.log(srtParseArr)

    })
    return (
        <div>
            <div>
                {

                }
            </div>
        </div>
    )

}