sunmingtao / sample-code

3 stars 4 forks source link

Bash script: combine downloaded kantv ts files #189

Closed sunmingtao closed 3 years ago

sunmingtao commented 3 years ago

run the script in /Users/mingtao/Library/Application Support/kantv/Download/video/<tv-name>

#!/bin/bash

SAVEIFS=$IFS
IFS=$(echo -en "\n\b") 

for folder in $(ls 2>/dev/null) # replace "1 720p" with "1"
do
    index=$(echo $folder | sed 's/\(.*\) .*/\1/g')
    cat "$folder"/*.ts > $(printf '%02d\n' $index).ts
done
IFS=$SAVEIFS