LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash :: Dual Language Subtitles (https://www.linuxquestions.org/questions/programming-9/bash-dual-language-subtitles-948306/)

cin_ 06-18-2012 12:17 AM

Un Long Dimanche De Fiançailles
 
3 Attachment(s)
Sorry, I am traveling at the moment... reliable access is scattered.

Here are three attachments. The first is a side by side depiction of the original subtitle files.

The second is the stacked subtitle file after running Submerge.

The third is the stacked subtitle file after running DualLanguage.


Of note: I am using python3. I see you wrote the script with python2.x so I changed your
Code:

print "usage:"
to
Code:

print("usage:")
perhaps the version discrepancy is the issue? After a quick debug run everything appears to be running smoothly, but with the same results.

pierrepoulpe 06-18-2012 04:23 AM

Hello,

About python version, yes I use default package supplied with my distrib (ubuntu 11.04) : python 2.7.1. Ok for your change, I'll incorporate in my code.

For character encoding, I see on you screenshots that output is readable, but not input. Is it not working with your video player?

For the result, what you get from submerge is correct, regarding how I designed it. Like I said, it would be nice to have a few more lines to link together starting points or ending points that are close enough (let's say 500ms)

cin_ 06-18-2012 06:00 AM

Yeah, sorry; the accents issue was something to do with Vim I suppose.
Those screenshots are of emacs and it seems comfortable with your hardcoding.
Also, I understand the duplicate entries now... it just remains on screen with each new entry with only a little flicker.

Its a cool program, and I like the pysrt. I'm glad you were moved to make a python `port'.

pierrepoulpe 06-18-2012 06:33 AM

Quote:

it just remains on screen with each new entry with only a little flicker.
Exactly. It's not nice to see when you look at the srt source, but when running, it's just a bit uncomfortable when title is moving from one line to another. To be improved...

* Also it uses a few more kilobytes, but who cares when it's beside a movie file big from 700MB to 8+GB !

aurerua 01-01-2013 03:40 PM

Hi,

Thanks a lot for the Python file.
I tried it and it is working all right.

Would there be an easy way though, to ensure that languages always get displayed in the same order, for instance French on the top and English at the bottom? With my trial they seem to change place all the time.

Best regards
Aurelien

cin_ 01-02-2013 12:38 PM

Bash Script
 
If you use the bash script from the original post it is consistent and pretty straightforward: my language, foreign language.

aurerua 01-02-2013 02:45 PM

@cin_ It is the only one I did not try in the thread... :o I am trying it now.

Thanks for the reply!

dhhkg 01-07-2013 02:08 PM

pierrepoulpe,

Thanks a lot for your python script. This is exactly what I have been looking for. In the first screenshot attached to your post, it shows some confusion in the beginning of the combined subtitles. I think that is probably because of different starting times of the subtitles to be merged. When the starting times are identical, it worked well.

Probably you can fix this by synchronizing all the timings of the two subtitle files with Subtitle Workshop, downloadable at the following website: http://www.urusoft.net/downloads.php?lang=1

By: Edit/Timings/Adjust/Adjust to Synchronized Subtitles

By the way, I am new to python and I have problem in installing the SRT Library pysrt in Windows XP environment.

Could you please give me some instructions?

Many thanks!

------

Anybody who knows how to install the SRT library pysrt in Windows XP?

I would appreciate it very much if you could give me a little hint.

Thanks a lot!

cin_ 01-08-2013 01:06 PM

python
 
I find it interesting that people coming to this thread all comment on the python script and suggest how to fix it.

The bash script works perfectly for its intended use... I could put more lines of code into beefing up its feature set, but as it stands it does what it is intended to do.

If it is a matter of language choice, sure, I can understand, I like python too.
But instead of incompletely trying to learn third party libraries and getting results that leave you wanting, you could take a minute to rewrite the implementation from the bash script into a python script. Devoid of any need for third party libraries.

patrick295767 01-08-2013 01:24 PM

1 Attachment(s)
Nice idea. I like.

If you like, you could also dictate the word while watching the moving. Check on Git for the full program.

Regards


All times are GMT -5. The time now is 06:45 PM.