brianspilner01 / media-server-scripts

82 stars 18 forks source link

sub-clean.sh and sub-clean-interactive.sh both remove trailing "r" characters on subtitle lines #13

Closed Tijs-B closed 3 years ago

Tijs-B commented 3 years ago

Hi,

Firstly, I want to thank you for the scripts you wrote! I'm having a weird issue with the shell scripts for cleaning subtitles. Trailing "r" characters always get removed, even when there aren't offending subtitles. It's happening on both my Mac (10.14.6) and raspberry pi with the latest libreelec installed. I attached a sample with some subtitles I extracted from a real srt file. In original.srt, the trailing "r" characters of "brother" and "father" both get removed when executing ./sub-clean.sh original.srt or ./sub-clean-interactive.sh original.srt. I used the latest commit on the master branch to test it. modified.srt is the output file of the sub clean script. I attached both files but renamed them to .txt files as Github doesn't allow srt files to be attached.

modified.txt original.txt

I can't see the error in the code, but I'm not really well versed in shell scripting.

Thank you!

Tijs-B commented 3 years ago

With further investigation, it seems line 37 in clean.sh is the culprit. Maybe it needs another \? I'm not familiar with sed...

brianspilner01 commented 3 years ago

I haven't been able to replicate this issue. I'm assuming it's indeed that line as you suggest, and you must have a different implementation of sed with libreelec. I'd suggest having a play (quite possibly an extra \ would fix it) or just removing that line if you're confident your srt files aren't using Windows style formatting (reasonably rare from my experience).