Handled Subtitle files with python

Hi to Everyone,

I have already blogged that Revolution OS being translated into Tamil Language. It comes to an end Shrini anna translated the entrire movie into tamil. It has been converted into soft copy by Myself and Ramya(Kanchi Lug Member). After then next process is dubbing but Shrini anna is waiting for confirmation of Director who having copy rights to the Revolution OS movie. Before that we decided to provide it as subtitle.

So shrini anna gave English Subtitle file and told to prepare a subtitle for tamil language try using python. First of all i saw both the files what are the things are having in the files then i realized we have to use both files for this process.

English Subtitle file looks like

1
00:00:04,000 –> 00:00:05,500
I was at Agenda 20002
00:00:06,100 –> 00:00:08,900
and uh, one of the people who was there was, Craig Mundie,

Tamil typed file looks like

1
Agenda 2000 நிகழ்ச்சிக்கு போயிருந்தேன்
2
அங்கே Criag Mundie இருந்தார்.

My python code used for this task is stated as follows


ta_c=open("/home/bala/Documents/tamilcontent",'r')
tm_li=open("/home/bala/Documents/timelines",'r')
ta_c=ta_c.readlines()
tm_li=tm_li.readlines()

for i in range(1502):
   new_file=open("tamil_subtitle","a")
   new_file.write(i+1)
   new_file.write(tm_li[i])
   new_file.write(ta_c[i])
   new_file.write("\n")
   new_file.close()

For time lines file i used a for loop and stored in a separate file. So it was easy to add in the new tamil subtitle file. Finally i add the extension of subtitle file .srt manually. 😉

May be this code was simple but i take a day to complete it, I feel that time doesn’t a matter for starting. I hope that for next i will do another task related to file handling less than the time which was taken for this.

I learned lot of things during this simple task,(i.e) “Try to convert all negative approaches into positive”

Example:

A soilder said to his King we are surrounded by the enemies in all sides. King replied with courage “No Problem, now we can attack them in any direction”. Like this we have  convert the negative approaches 🙂

Hope the code and quote will help to your life 😉

Thank You

With Regards,
V. Balakrishnan

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s