Page 1 of 1

Pascal script to join duplicated subtitles?

Posted: Wed Jun 29, 2016 3:26 pm
by subworkshopfan
Hi! I'm looking for a Pascal script to joined duplicated subtitles.
I have zero knowledge of programming language, otherwise I would do it myself... :oops:

The idea is to keep the initial time and the text of the first subtitle with the final time of the second subtitle, joining both subtitles into a single one.

Pretty much like this example:
202
00:06:13,031 --> 00:06:14,378
And just because that say
"Property of Men," that doesn't mean


203
00:06:14,378 --> 00:06:14,668
And just because that say
"Property of Men," that doesn't mean


Into this:
202
00:06:13,031 --> 00:06:14,668
And just because that say
"Property of Men," that doesn't mean


Can anyone please help me with my request?
Thanks in advance!

Greetings from Paysandú, Uruguay.

===============================

Hola! Estoy buscando un script Pascal que me permita unir subtítulos duplicados o dobles.
No tengo conocimientos de lenguaje de programación, de otro modo lo haría yo mismo... :oops:

La idea es conservar el texto y el tiempo inicial del primer subtítulo, y el tiempo final del segundo subtítulo, uniéndolos en un único subtítulo.

¿Podría alguien ayudarme con esto, por favor?
Desde ya, ¡muchas gracias!


Saludos desde Paysandú, Uruguay.

Re: Pascal script to join duplicated subtitles?

Posted: Thu Jun 30, 2016 10:59 am
by URUWorks
Claro, el código seria algo así:

Code: Select all

// -------------------------------------------------------------------------- //
//          Subtitle Workshop - join duplicated subtitles extension           //
//                          Copyright © 2016 URUWorks                         //
//                             http://uruworks.net                            //
//                                                                            //
//  The idea is to keep the initial time and the text of the first subtitle   //
//  with the final time of the second subtitle, joining both subtitles into   //
//  a single one.                                                             //
//                                                                            //
// -------------------------------------------------------------------------- //

program JoinDuplicatedSubtitles;

// -----------------------------------------------------------------------------

var
  i, p, c : Integer;
begin
  c := GetSubtitleCount;
  if not c > 1 then Exit;

  i := c-1;
  while i > 0 do
  begin
    p := i-1;
    if GetSubtitleText(i) = GetSubtitleText(p) then
    begin   
      SetSubtitleFinalTime(p, GetSubtitleFinalTime(i));
      DeleteSubtitle(i);
    end;
    i := p;
  end;
end.

// -----------------------------------------------------------------------------

end.

Re: Pascal script to join duplicated subtitles?

Posted: Thu Jun 30, 2016 11:17 am
by subworkshopfan
¡Fantástico, Aldo!

Muchas gracias. :D

Re: Pascal script to join duplicated subtitles?

Posted: Tue May 09, 2017 8:17 am
by laet74
Thanks for this reply