本帖最后由 idwma 于 2021-10-11 23:39 编辑
- @powershell "type '%~0'|select -skip 1|out-string|iex"&pause&exit
-
- [IO.File]::ReadAllLines("draft_content.json") -split "{"|%{
- if ($_ -match '"material_name":"(.*?)","material_url":"","path":"(.*?)"'){$name=$matches[1];$path=$matches[2]}
- if ($_ -match '"content":"(.*?)"'){[array]$a+=$matches[1]}
- if ($_ -match '"duration":(.*?),"start":(.*?)}'){
- if ($matches[2] -ne 0){
- [array]$b+=(("{0:HH:mm:ss,ff}" -f [datetime]([int64]$matches[2]*10)),("{0:HH:mm:ss,ff}" -f [datetime](([int64]$matches[2]+[int64]$matches[1])*10))) -join ' --> '
- }
- }
- }
- for($i=0;$i -le $a.count;$i++){
- $c+=($i+1),$b[$i],$a[$i],"",""
- }
- $c>([io.path]::GetDirectoryName($path)+"\"+[io.path]::GetFileNameWithoutExtension($path)+".srt")
复制代码
|