From 45ffd4c97c217943f15f5cda33de7c8f4f528a41 Mon Sep 17 00:00:00 2001 From: mappu Date: Wed, 20 Apr 2022 19:05:39 +1200 Subject: [PATCH] initial commit --- linesplit.php | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 linesplit.php diff --git a/linesplit.php b/linesplit.php new file mode 100755 index 0000000..ce78938 --- /dev/null +++ b/linesplit.php @@ -0,0 +1,74 @@ +#!/usr/bin/php + 5000) { + // flush buffer before adding + flushwords($nextbuffer); + $nextbuffer = ''; + $buffwords = 0; + } + + $nextbuffer .= $line."\n\n"; + $buffwords += $linewords + 2; + + // echo "entry {$nextline} had {$linewords}, current total {$buffwords}\n"; + +} while($nextline < count($lines)); + +flushwords($nextbuffer); +$nextbuffer = ''; +$buffwords = 0; + +// All flushed +// Write the final output + +file_put_contents($_SERVER['argv'][1].'.en.deepl.srt', $output_buffer);