0
I am developing a project in Laravel 8 and this project consists of a SRT subtitle management system. In the world of subtitling teams divide an entire caption (srt file) into several slots. In other words, a srt file is divided into several srt files so that each team member is responsible for their part in question. That being said, I wanted to find a solution so that I could uple the entire file on the system, choose the number of slots in which it would be split and thus generate multiple srt files (derived from the main/entire file that I upeuped).
If I do this, it would prevent me from dividing the file manually and having to uproot 1 by 1.
A srt file follows this pattern:
It has a type of ID (numbering), start/end time and legend. However, the legend can vary between 1 to 2 lines, which breaks the pattern a little.
I thought about doing the line counts and then manipulating based on the pattern, but it would become unviable because some have 1 or 2 lines as I mentioned earlier. Ex.:
<?php
$arquivo = fopen('meuarquivo.srt','r');
if ($arquivo == false) die('Não foi possível abrir o arquivo.');
while(true) {
$linha = fgets($arquivo);
if ($linha==null) break;
echo $linha;
}
fclose($arquivo);
?>
Can anyone help me with a hint of how I could manipulate this in PHP and DB?
you can t using the
RegExp
for is including the formats or even checking these id without knowing where the values are positioned on each line– gleisin-dev
Is this blank line separation a pattern? If so, maybe to make a
explode
in the " n", more or less soexplode("\n\n", file_get_contents('arquivo.srt'));
the result must be an array where each element is a slot– Skywalker
Beforehand, thank you for the answers. That’s a pattern to this line separation in white. Ball show the idea, I’ll do some tests to see if it works.
– Antonio