Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRT converting issue #29

Closed
pagenoare opened this issue Oct 6, 2015 · 8 comments
Closed

SRT converting issue #29

pagenoare opened this issue Oct 6, 2015 · 8 comments

Comments

@pagenoare
Copy link

Heya,

Recently, because of the player I'm using (which doesnt support TXT subtitles), I've enabled converter option.

Overall it works OK, BUT there's too many new line characters added, which is causing issues in my player. I've created a simple python script, which takes care of those characters.

subtitles = open('subtitles.srt', 'r')
content = subtitles.readlines()
subtitles.close()
new_subtitles = open('subtitles_new.srt', 'w')
new_subtitles.write('\n'.join([x.strip() for x in content if x.strip()]))
new_subtitles.close()

After running those couple of lines, the subtitles are working fine with my player.

Any chance that this can be fixed in the core?

Thanks for this software!

Regards,
Kacper.

@krzemin
Copy link
Member

krzemin commented Oct 6, 2015

Could you please post fragment of that incorrectly produced SRT file?

@pagenoare
Copy link
Author

Sure.

1

00:00:06,000 --> 00:00:12,074

Zareklamuj swój produkt lub Firmę

zkontaktuj się www.OpenSubtitles.org dzisiaj



2

00:00:12,000 --> 00:00:15,950

www.NapiProjekt.pl - nowa jakość napisów.

Napisy zostały specjalnie dopasowane do Twojej wersji filmu.



3

00:00:16,000 --> 00:00:18,100

Chodź do nas, Murphy.



4

00:00:22,600 --> 00:00:25,600

- Co jest?

- Dobrze się bawicie?


After my Python script:

1
00:00:06,000 --> 00:00:12,074
Zareklamuj swój produkt lub Firmę
zkontaktuj się www.OpenSubtitles.org dzisiaj
2
00:00:12,000 --> 00:00:15,950
www.NapiProjekt.pl - nowa jakość napisów.
Napisy zostały specjalnie dopasowane do Twojej wersji filmu.
3
00:00:16,000 --> 00:00:18,100
Chodź do nas, Murphy.
4
00:00:22,600 --> 00:00:25,600
- Co jest?
- Dobrze się bawicie?

@krzemin
Copy link
Member

krzemin commented Oct 7, 2015

OK, so it seems that every single line is separated by additional empty line.

QNapi uses CLRF ("\r\n") as line separator, which should be correctly recognized by most of systems/software, so I think that this is not necessarily a problem. It's hard verify now, but I suspect that reader of the input format has some defect and produce content with additional newline tokens.

Could you provide link to original, untouched (without conversion enabled) subtitles downloaded by QNapi, which the problem concerns?

@pagenoare
Copy link
Author

LOL

I think I've found the issue - the subtitles I was converting were already in SRT format.
https://gist.github.com/pagenoare/ed671ec53669ae591d12

So it more like SRT (original) -> (qnapi's conversion) -> messed up SRT.

Tried on different Series now, and it downloaded .txt subtitles, which were in SRT format. It converted it wrong too.

TXT: https://gist.github.com/pagenoare/84ca931d5a84998680f3
Converted SRT: https://gist.github.com/pagenoare/6701412b5fddd5ccadde

IMO, You're missing some detection IF downloaded subtitles are in the format requested by converter. If they are, just change the extension and should be fine, hm?

Thanks!!

@krzemin
Copy link
Member

krzemin commented Oct 22, 2015

Well, I couldn't reproduce conversion resulting with messed up file that you have provided.

It's nothing wrong that QNapi reads SRT file and produce resulting file in SRT format too. Sometimes that is desired behaviour - that kind of "conversion" performed by QNapi can fix incorrect SRT in some cases.

The problem is that I converted subtitles from gitsts that you provided, resulting with no problematic empty lines. Similarly, I downloaded other subtitles in SRT format for certain movies, having enabled target format conversion to SRT - again without empty lines.

So far I checked that on Linux only.

Basing on current knowledge, it can be:

  • some OS-dependent problem - please provide info about your operating system (name, version, etc.),
  • configuration-dependen problem - could you please localize and post your qnapi.ini file?

Another question: what text viewer you use to preview resulting srt files (where you see the empty lines)? Does it change when you use other text viewer?

@pagenoare
Copy link
Author

I'm using Windows 8.1,
qnapi.ini: https://gist.github.com/pagenoare/d123037a9de5b7a5c471

I can check later on Linux or OSX if you like.

I'm using Sublime, Vim, Atom to see the file, on all of them - this issue is visible. (it can be fixed via Python, so it's not really editor issue, but the chars).

@edit
I'm not saying it is wrong that QNapi is parsing srt to srt; I'm saying, that something is wrong on that level.

Thanks,
Kacper.

@krzemin
Copy link
Member

krzemin commented Oct 24, 2015

I checked that both on Windows 7 and Windows 10 with your config applied - none of them inserted additional empty lines to resulting files.

I can check later on Linux or OSX if you like.

Yes, if you can - it could confirm or eliminate dependency on OS.

@pagenoare
Copy link
Author

Will do later today / tomorrow morning!

sob., 24 paź 2015, 19:23 Piotr Krzemiński użytkownik <
notifications@github.com> napisał:

I checked that both on Windows 7 and Windows 10 with your config applied -
none of them inserted additional empty lines to resulting files.

I can check later on Linux or OSX if you like.

Yes, if you can - it could confirm or eliminate dependency on OS.


Reply to this email directly or view it on GitHub
#29 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants