Release -  Subtitles Mangler - A comprehensive subtitle companion
#1
I started developing this addon mainly to get some practice in Python programming but also to improve movie watching experience for my family.
The main drive was to convert downloaded subtitles to display them with solid black background to improve subtitle readability.

The current list of implemented features include:

1) invoking subtitle search dialog at playback start taking into account local subtitle files availability:
- recognizes if there are subtitle files already downloaded or not (takes into account .ass format or optionally any supported subtitle format matching name of video being played) 
- recognizes 'noautosubs' file (per directory) and '.noautosubs' extension (per file) whose presence prevents subtitle search dialog from opening
- tries to identify if video file includes internal forced subtitles matching preferred language, and if so, doesn't open subtitle search dialog
- recognizes if subtitle search dialog was opened but no new subtitles were downloaded and asks if the dialog should be open again next time this video is played, which prevents constant opening subtitle search window each time a particular movie is played

2) detecting if subtitle file was downloaded locally and perform conversion
- gives ability to customize subtitle font color (foreground) and its background color and transparency, which makes subtitles more easy to read
- support subtitles input formats: microDVD, SubRip, MPL2 and TMP
- allows to increase line spacing in 2-line texts, which prevents backgrounds overlap
- allows to filter subtitle contents based on various Regular Expression type criteria, which gives ability to remove unwanted texts, such as Hearing Impaired tags, advertisements, credits, etc.
- allows to increase subtitle display time to match at least minimum calculated time based on subtitle text length, taking into account start time of the next subtitle line
- allows to make a backup copy of converted subtitle file

3) detecting if video was removed from local storage and removing any related subtitle files located within Kodi's video media paths (takes into account subtitle files generated during conversion and optionally also any other subtitle files already residing on disk).
As I consider removing any files as potentially dangerous action, additional "simulation" option is enabled by default. Therefore it is possible to see in logs what files would be deleted.


Addon can be downloaded from Official Kodi Repo.

It works only in Kodi 17 and later as older versions lack some required API.

All logging can be directed to separate file. Debug level allows to log virtually every action the addon performs. Logs are rotated on daily basis. Two rotated copies are kept.

As a proper detection of file encoding seems to be a challenging task, the current implementation tries to guess encoding based on subtitle language. Fortunately new texts are mostly encoded in UTF-8. 

As current languages for UI include English, Polish, Hungarian, Czech, Slovak and German at the moment, help with other languages will also be greatly welcomed for both UI and filtering definitions.
Odroid C2; Libreelec 9.0.0
Reply
#2
Thanks for this, I really like the idea.
Unfortunately on my Nvidia Shield TV the Add-on doesn't seem to work.

I tried a few mkv files with accompanying srt in the same folders but the srt files aren't converted.
Also found that a lot of my mkv files with embedded subtitels don't have the subtitel language flag set, that prompts the sub search window to pop up.
It would be nice if we could have an option to disable the search window when an undermined subtitle is found.

LOG: https://hastebin.com/afapanijex.sql
Image
Reply
#3
(2018-02-22, 10:48)BZwart Wrote: I tried a few mkv files with accompanying srt in the same folders but the srt files aren't converted. Let me know if you need a log.
Also found that a lot of my mkv files with embedded subtitels don't have the subtitel language flag set, that prompts the sub search window to pop up.
It would be nice if we could have an option to disable the search window when an undermined subtitle is found.
By design, addon detects only freshly downloaded subtitles and then converts it to .ass format. At the moment, it ignores any subtitles already residing on disk but I think it can be improved.
Option to not invoking search dialog if subtitle file is found in any format (currently it does it only for .ass format - which I consider a target subtitle format) shouldn't be a problem to add.
Odroid C2; Libreelec 9.0.0
Reply
#4
(2018-02-22, 11:29)bkiziuk Wrote:
(2018-02-22, 10:48)BZwart Wrote: I tried a few mkv files with accompanying srt in the same folders but the srt files aren't converted. Let me know if you need a log.
Also found that a lot of my mkv files with embedded subtitels don't have the subtitel language flag set, that prompts the sub search window to pop up.
It would be nice if we could have an option to disable the search window when an undermined subtitle is found.
By design, addon detects only freshly downloaded subtitles and then converts it to .ass format. At the moment, it ignores any subtitles already residing on disk but I think it can be improved.
Option to not invoking search dialog if subtitle file is found in any format (currently it does it only for .ass format - which I consider a target subtitle format) shouldn't be a problem. 
For TV series my subtitels are mostly downloaded by an external program, SickRage in my case.
So most of my subtitles are always already residing on disk. I t would be great if we could have an option also scan and convert those.
Image
Reply
#5
I added two new configuration options. The first one should prevent search dialog from opening if local unprocessed subtitles are found.
The second one will trigger conversion for any subtitle file on disk matching video file being played regardless its creation time.
This, however, has a drawback that if you have more than one subtitle file for a video (for example in .srt and .sub format), the routine will be triggered for every file, with the next resulting file overwriting the previous one.
Both options are off by default, so they will need to be enabled by hand.
There is still some more testing to be done. It should happen before the weekend. Once completed, I will push the new version to repo.

EDIT: new build is online
v0.0.15 (2018-02-23)
- added ability to convert local subtitle files accompanying played video file
- added Hungarian UI language
Odroid C2; Libreelec 9.0.0
Reply
#6
(2018-02-23, 08:36)bkiziuk Wrote: EDIT: new build is online
v0.0.15 (2018-02-23)
- added ability to convert local subtitle files accompanying played video file
Thanks, I tried the new build but for me the convert local subtitle isn't working yet.
When I start a video with an .srt file in the same folder on my NAS the conversion starts, the original .srt is renamed to .srt_backup bu then the process stops.
No .ass formatted file is created, so no subtitels are displayed.
When downloading a new subtitel from within Kodi, the .srt on disk is renamed and a converted .ass is created on the NAS and used.
Image
Reply
#7
(2018-02-25, 16:57)BZwart Wrote: When I start a video with an .srt file in the same folder on my NAS the conversion starts, the original .srt is renamed to .srt_backup bu then the process stops.

Please enable Info level logging within the SubsMangler settings and when the issue occurs again provide kodi.log file.
This happens sometimes during testing but I wasn't been able to pinpoint the root cause yet. It seems that for some reason xbmcvfs.copy() function doesn't success.
Odroid C2; Libreelec 9.0.0
Reply
#8
I wil make a log asap

LOG: removed
Image
Reply
#9
(2018-02-25, 17:35)BZwart Wrote: LOG: removed

It seems to be this issue.
How often does it happen?
Odroid C2; Libreelec 9.0.0
Reply
#10
For me it happened every time I tested.
Until now I haven't made a successful conversion of an existing srt
Image
Reply
#11
Give me some time and I'll see what I can do about it...
Odroid C2; Libreelec 9.0.0
Reply
#12
@BZwart 
Would you mind to switch to my test repo:
https://bkiziuk.github.io/kodi-repo/test...-1.0.1.zip
and install 0.0.18 build from there to check if situation has improved in your environment?
It has some more logging enabled (also logs subtitles read from file, so the output would be rather huge as compared to normal output), so please also set Kodi log to Debug level and smangler log to Info level.
Odroid C2; Libreelec 9.0.0
Reply
#13
(2018-02-27, 09:00)bkiziuk Wrote: @BZwart 
Would you mind to switch to my test repo:
https://bkiziuk.github.io/kodi-repo/test...-1.0.1.zip
and install 0.0.18 build from there to check if situation has improved in your environment?
It has some more logging enabled (also logs subtitles read from file, so the output would be rather huge as compared to normal output), so please also set Kodi log to Debug level and smangler log to Info level.
Did a quick test with one video and it now worked.
I have an .ass file in my NAS folder and it was used nicely when playing the mkv file (I had a semi transparent background)

I will do some further testing later when  have a bit more time.
Thanks for looking into the issue.

EDIT: tested a few video files with existing srt files. Worked every time.
I guess you don't need any further logs, otherwise please let me know.
Image
Reply
#14
(2018-02-27, 10:44)BZwart Wrote: EDIT: tested a few video files with existing srt files. Worked every time.

Many thanks for your test.
Please help to test one more build. I have just uploaded 0.0.19 version to test repo.
I changed copy routine from xbmcvfs.read() + xbmcvfs.write() to xbmcvfs.copy().
I want to see if it will still work flawlessly. 
As there is also a loop that tries to copy file 3 times if the previous try fails, it would be magnificent if you could provide log from every test. Therefore we can see if every try was without any issues.
Odroid C2; Libreelec 9.0.0
Reply
#15
At the moment I don't see the 0.019 yet in the test repo, I will try again in the morning. I also noticed an error when starting Kodi. Mangler does a subtitles scan followed by an error. I will include it in the next log.

Edit: even with v 0.018 the files I used for testing all day suddenly stopped working.
Image
Reply
 
Thread Rating:
  • 1 Vote(s) - 4 Average



Logout Mark Read Team Forum Stats Members Help
Subtitles Mangler - A comprehensive subtitle companion41