Monday 10 January 2022

R.I.P. James Bond

 I can't believe they killed James Bond in the name of some dubious political correctness! Now back to oil painting - I watched this video and followed its techniques. Here is the result:



Saturday 1 January 2022

Subtitles - in Awk

 Last year, well, yesterday I wrote a simple javascript to fix the SRT file to a French movie and the result was good. I got to enjoy the movie. Then I thought I could go back to my root and rewrite it as unix shell script - awk script to be more precise. So here it is:

#!/bin/awk -f

BEGIN {
    FS=" --> ";
    RS="\r\n";
}
{
    if ($2 != "") {
        ssecond=substr($0,7,2);
        esecond=substr($0,24,2);
        if( ssecond<59) ssecond++;
        if( esecond<59) esecond++;
        printf("%s%02d%s%02d%s\n", substr($0,1,6), ssecond, substr($0,9,15), esecond, substr($0,26,4));
    }
    else
        print;
}

No surprise, the performance of the awk script is much better than Node.js.


$ time ./srt_update.awk input.srt > output.srt

real    0m0.020s
user    0m0.009s
sys     0m0.000s