Broken OpenSubtitles.com - Downloaded subtitles creates zero file size with no permission
#1
I am running LibreElec 12.0.1 with Kodi (Omega) v21.1 on RPI4 there I have installed the OpenSubtitles.com v1.0.5 add-on, all films are stored on a NFS mounted SuSe linux NAS.
The add-on is configured to store the subtitle next to the movie and download of the subs works fine, but when I later restart the film and select the external downloaded
subtitles no subtitles are shown. When I look at the folder on the NAS the subtitle-file has zero length and no access rights:

# ls -al Canary.Black.2024/
total 4398636
drwxrwxrwx    2 samba users       4096 Nov 17 13:21 .
drwxrwsr-x 1097 samba users      65536 Nov  7 20:16 ..
-rw-rw-r--    1 samba users 4504116098 Nov  7 20:16 Canary.Black.2024-1080p.AMZN.WEB-DL.mkv
----------    1 samba users          0 Jan  1  1970 Canary.Black.2024-1080p.AMZN.WEB-DL.sv.srt

my /etc/exports:
/share *(fsid=1,anonuid=1100,anongid=100,rw,no_acl,insecure,root_squash,sync,no_subtree_check)

I have logged in to the RPI and manually mounted the NFS file-system and executed "# echo hello > hello.txt"
and the file was created with correct owner, permissions and size on the NFS-drive.
Reply
#2
(2024-11-17, 16:46)boris61 Wrote: and the file was created with correct owner, permissions

the file created by kodi has the correct owner and permissions, see your own example
 
(2024-11-17, 16:46)boris61 Wrote: ----------    1 samba users          0 Jan  1  1970 Canary.Black.2024-1080p.AMZN.WEB-DL.sv.srt

it just has the wrong file mode
try adding a chmod after the file creation and see if it works - https://www.geeksforgeeks.org/python-os-chmod-method/
(i don't know if kodi has a specific method for this)
Reply
#3
if chmod works then i suggest switching to xbmcvfs for writing instead of os https://romanvm.github.io/Kodistubs/_aut...mcvfs.html

python:
with xbmcvfs.File(file, 'w') as f:

if it does not then there is a different issue at hand
Reply
#4
Yes, I suspect the core problem is in subtitle_downloder.py:142, it uses python file open when it should have used xbmcvfs.File(file, 'w') for correct file operation towards kodi Virtual file system.

python:

        if (valid==1):
            with xbmcvfs.File(subtitle_path, 'w') as file:
                file.write(self.file["content"])
                file.close()
 

I am pretty new to the kodi dev env. and how the apps are assembled to be able to install the corrected one. Is there any decent how-to?
Reply
#5
(2024-11-18, 20:48)boris61 Wrote: I am pretty new to the kodi dev env. and how the apps are assembled to be able to install the corrected one. Is there any decent how-to?

not any real assembly, as you see it on github is exactly how it installs without any intermediary
open your userdata folder, locate addons, locate the addon folder for this and you can test any changes to python *almost live, the one caveat is that kodi caches the code so you have to restart kodi to affect changes properly
(linux will be ~/.kodi)

the official guide is here though https://kodi.wiki/view/Add-on_development
Reply
#6
Thank's for all the help. After some digging I found it and did the changes directly on the Kodi. Sadly non of it worked, neither the chmod() nor switch to xbmcvfs.File(). There is something very awkward and strange happening he
re.
Reply

Logout Mark Read Team Forum Stats Members Help
OpenSubtitles.com - Downloaded subtitles creates zero file size with no permission0