All pastes #1776424 Raw Edit

Stuff

public php v1 · immutable
#1776424 ·published 2010-02-02 23:58 UTC
rendered paste body
<?phpheader('Content-Type: text/plain; charset=utf-8', TRUE);$a = file_get_contents("video.jsub"); // Arquivo$b = "\xff\xfe\xfd\xfc"; // Boundary$a = str_replace($b . '{"captions":[', '', $b . $a);$a = str_replace(']}' . $b, '', $a . $b);$a = str_replace('},{"content":"', "\x00", $a);$a = str_replace($b . '{"content":"', '', $b . $a);$a = str_replace('}' . $b , '', $a . $b);$a = str_replace('","startTime":', "\x01", $a);$a = str_replace(',"duration":', "\x02", $a);$a = str_replace("\\\"", "\"", $a);$a = $a . "\x00";$o = 500; // Offset$in = 1; // Índicewhile(($fdl = strpos($a, "\x00", 0)) !== FALSE) { // Fim da linha    $pl = $fdl + 1; // Próxima linha    $l = substr($a, 0, $fdl); // Linha    $a = substr($a, $pl); // Resto do arquivo    $dp = strpos($l, "\x02", 0); // Posição da duração    $d = substr($l, $dp + 1); // Duração    $l = substr($l, 0, $dp); // Linha    $ip = strpos($l, "\x01", 0); // Posição do início    $i = substr($l, $ip + 1); // Início    $i = $i + $o; // Início trocado    $t = $i + $d; // Termina    $l = substr($l, 0, $ip); // Linha    echo($in . "\r\n" .'00:00:00,' . $i . ' --> 00:00:00,' . $t . "\r\n" .$l . "\r\n" . "\r\n"    );    $in = $in + 1;}?>