bazarr icon indicating copy to clipboard operation
bazarr copied to clipboard

Translate: Malformed

Open gianfelicevincenzo opened this issue 1 year ago • 12 comments

Describe the bug Translate from english to italian. Error report in log is:

BAZARR is unable to translate malformed subtitles: /media/plex/film/moviemedia/Sadistic - The Exorcism Of Lily Deckert (2022) {imdb-tt11443106}/Sadistic - The Exorcism Of Lily Deckert (2022) {imdb-tt11443106}.srt

To Reproduce Steps to reproduce the behavior:

  1. Go to Movie
  2. Click on '...'
  3. Click in menu on Translate
  4. Choose language italian

Expected behavior Translated movie subtitle

Software (please complete the following information):

  • Bazarr: v1.4.3 2024-06-02 MASTER

subs.txt

gianfelicevincenzo avatar Jun 08 '24 17:06 gianfelicevincenzo

Your subtitles is probably malformed as stated in log. I've just test with a random subtitles and it works as expected.

image

morpheus65535 avatar Jun 18 '24 02:06 morpheus65535

Your subtitles is probably malformed as stated in log. I've just test with a random subtitles and it works as expected.

Wat do you mean with malformd? I have the same issue with almost every subs. I`m trying translate to dutch.

Version: v1.4.3-ls254 by linuxserver.io

BAZARR is unable to translate malformed subtitles: /mnt/nfs/01-Movies/Late Night with the Devil (2024) {imdb-tt14966898}/Late Night with the Devil (2024) {imdb-tt14966898} [WEBDL-1080p][EAC3 5.1][h264]-BYNDR.en.srt

BramFr avatar Jun 18 '24 15:06 BramFr

I have the same problem, using same Version: v1.4.3-ls254 by linuxserver.io I am trying to translate to french, though. The curious works to spanish (the current spanish subtitles was translated without problem from the same english source), but someway, the french is not working. It happens often with the tv shows. bazarr.log

resuarez avatar Jun 20 '24 09:06 resuarez

Just create a new log using common fixes in the source subtitles and trying to translate, finally, after couple tries, it worked bazarr-with-translation.log Checking between the original subtitles and the fixed copy, I've found this difference image

However, I want to point that the file was translated initially to spanish without problem So, I don't think that it is the problem image

resuarez avatar Jun 20 '24 10:06 resuarez

Just try with another show, I usually translate to french and spanish. And this time, the french was translated, but not the spanish bazarr-evil.log I hope it helps.

resuarez avatar Jun 20 '24 10:06 resuarez

I had this happen to me too, in my case I look at the subtitles and find many "—" at end of sentences. remove them all and then it was able to translate

napalmpt avatar Jun 20 '24 13:06 napalmpt

I will check. However, previous version worked flawless. So, something changed in the code.

resuarez avatar Jun 21 '24 09:06 resuarez

I've been able to reproduce the issue with a subtitles. I've made a small fix that seems to correct the issue on my side. Can you test upcoming beta and let me know?

morpheus65535 avatar Jun 24 '24 15:06 morpheus65535

I've just tested the v1.4.4-beta.11 and I cannot reproduce the issue. However, I would like to do more testing. I will update any findings. Thank you for your work and help.

resuarez avatar Jun 26 '24 00:06 resuarez

I cannot reproduce the issue with the v1.4.4-beta.11. For my side, I think the problem was solved. Thank you again

resuarez avatar Jun 28 '24 11:06 resuarez

@vincenzogianfelice can I close this issue as fixed?

morpheus65535 avatar Jun 28 '24 12:06 morpheus65535

@morpheus65535 I'll check in a couple of days and let you know. I can not at the moment

gianfelicevincenzo avatar Jun 28 '24 14:06 gianfelicevincenzo

No news, good news!

morpheus65535 avatar Jul 08 '24 03:07 morpheus65535

I am having this same problem, English to French. Did anyone find a fix?

Manny8787 avatar Jul 15 '24 16:07 Manny8787

@morpheus65535 From the little I've tried (same film and same subtitles) the problem hasn't recurred. I will keep you updated if there are any problems. Sorry but between holidays and work now I don't have much time!

gianfelicevincenzo avatar Jul 18 '24 18:07 gianfelicevincenzo

I am having this same problem, English to Portuguese. Even applying "Common Fixes" is not solving the problem.

Version: v1.4.4-beta.30

helissonms avatar Aug 10 '24 00:08 helissonms

I had some problems too. But, it is more rare and complicated to reproduce. I usually translate from English to French and Spanish and I get one of the language translated, but the other not. I have to modify the original in other to get the second language translated. However, I didn't report it because I cannot reproduce the issue a will, like before

resuarez avatar Aug 10 '24 17:08 resuarez

Finally, I was capable to reproduce the issue. I have this srt (from unknown movie)
Angels Fallen Warriors of Peace (2024) [WEBRip-720p] [YTS.MX].en.zip And the log with the error: bazarr.log If I open the subtitle with Subtitle editor software, it doesn't show any problem, and even, I can translate with its tool without any issue. The subtitle, I think is the shd type, with a lot of words between square brackets. Not sure if it is the problem. Or maybe an special character.

resuarez avatar Aug 12 '24 12:08 resuarez

I also have this problem, English to Thai. With almost all the translations. Sometimes I can try 3-4 times and then it works, but sometimes even after multiple attemps it won't translate. Applying "Common Fixes" is not solving the problem.

Version: v1.4.3

elektron303 avatar Aug 13 '24 11:08 elektron303

English to Dutch here same error, I'm on version 1.4.3. I just tested the committed fix, https://github.com/morpheus65535/bazarr/commit/9049ab2238c46355e6896ed07ebf4e66442a91af; and it works.

driesmp avatar Aug 13 '24 18:08 driesmp

English to Dutch here same error, I'm on version 1.4.3. I just tested the committed fix, 9049ab2; and it works.

Yes, this also did the trick for me. Had problems translating from English to Dutch also. I run in Docker. What i did:

Log in to docker container with: docker exec -it bazarr bash Edit the file translate.py in directory: /app/bazarr/bin/bazarr/subtitles/tools Restart container

After that it works.

Also a side node. there is a line (47) with:

joined_lines_str = '\n\n\n'.join(lines_list)

I did not change this line. I only change like described in: https://github.com/morpheus65535/bazarr/commit/9049ab2238c46355e6896ed07ebf4e66442a91af

TheWalkingDadNL avatar Aug 13 '24 20:08 TheWalkingDadNL

I'm testing it on the development branch, where there is this solution, but it doesn't work.

helissonms avatar Aug 22 '24 11:08 helissonms

I applied the fix 9049ab2 It was working for some days. Now I have the issue again.

elektron303 avatar Sep 02 '24 09:09 elektron303

It was working for some days. Now I have the issue again.

Provide a new debug log reproducing the issue. I can't do anything with "I have the issue again".

morpheus65535 avatar Sep 02 '24 12:09 morpheus65535

bazarr.log I applied the fix like mentioned here https://github.com/morpheus65535/bazarr/issues/2519#issuecomment-2287119508

elektron303 avatar Sep 02 '24 12:09 elektron303

I applied the fix like mentioned here #2519 (comment)

2024-09-02 14:28:17|DEBUG |root |Bazarr version: 1.4.3|

You can't simply apply the fix, it will get overwritten. You either switch to nightly (dev branch) or you stay with master but you can't patch ti as you want.

Anyway, the translation process has been refactored and the fix you applied doesn't work anymore.

morpheus65535 avatar Sep 02 '24 12:09 morpheus65535

That makes sense. Thank you! EDIT: I switched to the dev branch. I'm on v1.4.4-beta.39 - Works flawless. Thank you again :)

elektron303 avatar Sep 02 '24 12:09 elektron303

I've been experiencing issues with some translations, I am using the latest beta version, particularly when handling special characters like "♪♪". After a detailed analysis, I've discovered that the problem lies with certain symbols. To further investigate, I added additional logging to the translate.py script to pinpoint the issue.

Here's an example from the log:

Exception on /api/subtitles [PATCH] | 2024-10-15 06:15:28
-- | -- | --
line_list=None | 2024-10-15 06:15:28 |
i=6 line=<SSAEvent type=Dialogue start=0:00:14 end=0:00:21 text='♪♪'> | 2024-10-15 06:15:28 | 
line_list=[Acclamations et applaudissements] | 2024-10-15 06:15:28 |  
i=5 line=<SSAEvent type=Dialogue start=0:00:12 end=0:00:14 text='[Cheers and applause]'> | 2024-10-15 06:15:28 |  
line_list=C'est l'heure du « Scrabble ». | 2024-10-15 06:15:28 |  
i=4 line=<SSAEvent type=Dialogue start=0:00:09 end=0:00:12 text='It\'s time for "Scrabble."'> | 2024-10-15 06:15:28 |  
line_list=pour avoir une chance de gagner jusqu'à 10 000 $. | 2024-10-15 06:15:28 |  
i=3 line=<SSAEvent type=Dialogue start=0:00:06 end=0:00:09 text='for their chance to win\\Nup to $10,000.'> | 2024-10-15 06:15:28 |  
line_list=ces deux détectives de l'orthographe s'affrontent | 2024-10-15 06:15:28 |  
i=2 line=<SSAEvent type=Dialogue start=0:00:04 end=0:00:06 text='these two spelling sleuths\\Nare going head to head'> | 2024-10-15 06:15:28 |  
line_list=Et bien, nos joueurs aussi. Et ce soir, | 2024-10-15 06:15:28 |  
i=1 line=<SSAEvent type=Dialogue start=0:00:02 end=0:00:04 text='Well, so do our players.\\NAnd tonight,'> | 2024-10-15 06:15:28 |  
line_list=-Tu penses avoir un don avec les mots ? | 2024-10-15 06:15:28 |  
i=0 line=<SSAEvent type=Dialogue start=0:00:01 end=0:00:02 text='-Think you have a way\\Nwith words?'> | 2024-10-15 06:15:28 |  
BAZARR Log file emptied

As you can see, the original text is '♪♪', but the translated text is None, which leads to a replacement failure and results in the following error:

Exception on /api/subtitles [PATCH] Traceback (most recent call last):
File "/app/bazarr/bin/bazarr/../libs/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
File "/app/bazarr/bin/bazarr/../libs/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/app/bazarr/bin/bazarr/../libs/flask_restx/api.py", line 402, in wrapper
    resp = resource(*args, **kwargs)
File "/app/bazarr/bin/bazarr/../libs/flask/views.py", line 110, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
File "/app/bazarr/bin/bazarr/../libs/flask_restx/resource.py", line 41, in dispatch_request
    resp = meth(*args, **kwargs)
File "/app/bazarr/bin/bazarr/api/utils.py", line 30, in wrapper
    return actual_method(*args, **kwargs)
File "/app/bazarr/bin/bazarr/api/subtitles/subtitles.py", line 175, in patch
    translate_subtitles_file(video_path=video_path, source_srt_file=subtitles_path,
File "/app/bazarr/bin/bazarr/subtitles/tools/translate.py", line 103, in translate_subtitles_file
    line.plaintext = lines_list[i]
File "/app/bazarr/bin/bazarr/../libs/pysubs2/ssaevent.py", line 115, in plaintext
    self.text = text.replace("\\n", r"\\N")
AttributeError: 'NoneType' object has no attribute 'replace'

Hope this help.

If you need the original str, let me know.

resuarez avatar Oct 15 '24 10:10 resuarez

@resuarez it should be fixed in upcoming beta. Thanks for reporting.

morpheus65535 avatar Oct 23 '24 22:10 morpheus65535

That is great, I will test it. If I find anything, I will report it. Thank you

resuarez avatar Oct 24 '24 21:10 resuarez