Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Potential Subtitle Handling Bug
#1
My English subtitles for the movie: No Time to Die (2020) are being registered as Norwegian subs. The filename of the subtitles is: No Time to Die (2020) English.srt

The cause of this is clear. The language code for Norwegian is "no" and "No" is at the start of the string of the movie title.

The only solution to this issue I have found is storing the movie and subtitles in their own folder and naming the subtitles as: English.srt
Reply
#2
(2021-12-03, 04:00)SEIKT Wrote: My English subtitles for the movie: No Time to Die (2020) are being registered as Norwegian subs. The filename of the subtitles is: No Time to Die (2020) English.srt

The cause of this is clear. The language code for Norwegian is "no" and "No" is at the start of the string of the movie title.

The only solution to this issue I have found is storing the movie and subtitles in their own folder and naming the subtitles as: English.srt
Reviewing the code at Util.cpp, I do not believe that is the cause.  The first thing the filename parser does for srt is remove the movie name.  (Confirmed testing on Kodi 19.3)

Could you provide a debug log showing you playing this movie?

scott s.
.
Reply
#3
(2021-12-03, 04:00)SEIKT Wrote: The filename of the subtitles is: No Time to Die (2020) English.srt
I think you named it wrong.

Try... No Time to Die (2020).eng.srt

https://forum.kodi.tv/showthread.php?tid...pid2861861
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#4
Should mention I am passing the subtitles path to a listitem via the setSubtitles method.

Here is the relevant info from the log. I tried the naming convention as you suggested Karellen, the issue persists.

2021-12-03 15:23:36.802 T:14324   DEBUG <general>: CUtil::GetExternalStreamDetailsFromFilename - Language = 'nor' / Name = 'Time to Die (2021) English (External)' / Flag = '0' from C:\Users\Jay\Documents\strm\movies\No Time to Die (2021) English.srt
Reply
#5
Here is another example of English Back the Future Part III subs being registered as Tongan. Seems to be because "to" is in the title - "to" is being extracted from the title.

2021-12-03 15:53:17.703 T:15444   DEBUG <general>: CUtil::GetExternalStreamDetailsFromFilename - Language = 'ton' / Name = 'Back the Future Part III (1990) eng (External)' / Flag = '0' from C:\Users\Jay\Documents\strm\movies\Back to the Future Part III (1990).eng.srt
Reply
#6
(2021-12-03, 06:32)SEIKT Wrote: Should mention I am passing the subtitles path to a listitem via the setSubtitles method.

Which part of that method?
- You mean you set a single path for all subtitle files?
- What about your preferred subtitle language?
- The language(s) to be searched for when downloading?

I have both your movies, and they are (always) handled with the correct subtitle language.

Best if you give us your full debug log (wiki) (via a pastebin-method please) instead of just single lines, otherwise this thread will take months...
Reply
#7
Unsure what you mean by which part of the method. For clarity sake this is an example of how subtitles are set:
 
Code:
item = xbmcgui.ListItem(path="http://localhost:{}/play".format(serverPort))
item.setSubtitles(["C:\\Users\\Jay\\Documents\\strm\\movies\\Back to the Future Part III (1990).eng.srt"])

What about your preferred subtitle language - English
The language(s) to be searched for when downloading - English

Here is the log
https://paste.kodi.tv/wavadasoge.kodi
Reply
#8
@SEIKT

I cannot replicate your issue. See from line 2872 in my log... https://paste.kodi.tv/ohoqifiqim.kodi where the subtitle file is correctly identified.
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#9
Going by that log you have strm files that point to your movie files which are stored on Google drive, I assume that's what's happening as the gdrive addon seems to be called. Is behaviour any different if you have both the movie file and subtitle file locally in the same folder so the use of strm's & Google drive is eliminated?
Reply
#10
I experimented with a local file using this code.
 
Code:
import sys
import glob
import xbmcgui
import xbmcplugin


filePath = xbmc.getInfoLabel("ListItem.FileNameAndPath")
subtitles = glob.glob(glob.escape(filePath.replace(".strm", "")) + "*srt")
xbmc.log("the subtitles are " + str(subtitles), xbmc.LOGERROR)

filePath = filePath.replace(".strm", ".mp4")
item = xbmcgui.ListItem(path=filePath)
item.setSubtitles(subtitles)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)


Subtitles don't appear in the selection. But it seems they were correctly identified as English at one stage according to the log.

https://paste.kodi.tv/dadaxukivi.kodi
Reply
#11
I omitted the setSubtitles function, subtitles are still detected. I think the ScanForExternalSubtitles call is what is identifying the correct subtitle language.
 
Code:
import sys
import glob
import xbmcgui
import xbmcplugin


filePath = xbmc.getInfoLabel("ListItem.FileNameAndPath")
filePath = filePath.replace(".strm", ".mp4")
item = xbmcgui.ListItem(path=filePath)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)

https://paste.kodi.tv/axusinomap.kodi
Reply
#12
Here's code you can try yourself.
 
Code:
import sys
import xbmcgui
import xbmcplugin


item = xbmcgui.ListItem(path="https://media.istockphoto.com/videos/old-ghetto-wires-4k-video-id1295601772")
item.setSubtitles(["C:\\Users\\Jay\\Documents\\strm\\movies\\Back to the Future Part III (1990).eng.srt"])
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)

ScanForExternalSubtitles doesn't get called when the path isn't to a local file. Something strange behind the scenes is going on with setSubtitles.

https://paste.kodi.tv/uvilefesas.kodi
Reply
#13
Maybe the Kodi code just needs to scan the filename backwards when looking for language as set subtitle wouldn't know the movie name to remove from the subtitle name.b
Reply
#14
@CastagnaIT ^^
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#15
The only thing I can see is in the original log, the filename of the sub seems to be correct based on
cpp:
CLog::Log(LOGDEBUG, "%s - Language = '%s' / Name = '%s' / Flag = '%u' from %s",
             __FUNCTION__, info.language.c_str(), info.name.c_str(), info.flag, CURL::GetRedacted(associatedFile).c_str());

results in
Code:
 CUtil::GetExternalStreamDetailsFromFilename - Language = 'nor' / Name = 'Time to Die (2021) eng (External)' / Flag = '0' from C:\Users\Jay\Documents\strm\movies\No Time to Die (2021).eng.srt

Which tells me that the movie name passed into the function isn't matching for some reason.  The thing that popped into my head was a problem of homoglyph, or something like Turkish I/i casing problem but that doesn't seem likely here.

scott s.
.
Reply

Logout Mark Read Team Forum Stats Members Help
Potential Subtitle Handling Bug0