View Single Post
Old 05-10-2008, 03:52 PM   #10
Playbahnosh
The Peacemaker
 
Playbahnosh's Avatar


 
Join Date: Apr 2005
Location: Veszprem, Hungary
Posts: 353
Send a message via MSN to Playbahnosh
Default

Okay, using _r.u.s.s.' idea, I created another pseudo-code, which replaces the timecodes instead of the subtitles themselves. Here:

Code:
OPEN file
X=0
IF search string "-->" returns result
   THEN:
       move pointer to location
       record line to variable T1
       delete line
       insert "00:00:00,000 --> 00:00:00,001"
       go down one line
   ELSE:
      msg: "Wrong file"
      END PROGRAM
END IF
REPEAT UNTIL X=1
   IF search string "-->" returns result
      THEN:
         move pointer to location
         record line to variable T2
         delete line
         insert line from variable T1
         move down one line
            IF search string "-->" returns result
               THEN:
                  move pointer to location
                  record line to variable T1
                  delete line
                  insert line from variable T2
                  move down one line
               ELSE:
                  X=1
            END IF
      ELSE:
         X=1
   END IF
END
SAVE file
CLOSE file
msg: "finished"
END PROGRAM
This is inarguably an easier method, and should be a cakewalk to put together, now.

Because the, fist line's timecode will be used as the second and the second's as the third...etc, I inserted a dummy timecode to the first line. By later deleting that line in-program, the indexing problem will be solved too.

A little help here?
__________________
The Master of Light and Darkness

"Don't fight the bad things in life! Find the good one! They are everywhere! Don't spend your life fighting for goals you can never reach! Live for the moment!"


BEWARE: I'm using the forums as a personal blog!
Playbahnosh is offline                         Send a private message to Playbahnosh
Reply With Quote