2021-12-28, 04:14
@nusstu Thanks for the logs, those are very helpful! As you appear to understand some Python and are technical, here's the full explanation of what's happening:
xbmcvfs is the virtual file system module that's able to work with archive files (with the help of the vfs.libarchive addon) without the need to extract them first. That's why the xbmcvfs.listdir function gets passed the archive file directly rather than a directory. It's meant to return all files and directories in the archive and then copy the first file it finds to the tempdir and proceed checking if it's a supported subtitle file.
The tempdir variable points to the directory with the random numbers that's created in the addon dir while downloading the subtitle archive. The file 'subscene.xxx' in that directory then gets renamed into 'subscene.rar' or 'subscene.zip' or 'subscene.srt' depending on what it is. If it's an archive, on Kodi 19 it uses xbmcvfs to look into the archive file (local_tmp_file variable) and copy the subtitles contained in it into tempdir (next to the archive file) for further processing. If it's Kodi older 19, it extracts the archive using XBMC.Extract (deprecated built-in Kodi function in Kodi 19) for further processing.
It appears, on Android xbmcvfs.listdir and/or vfs.libarchive work differently and listdir does not return the contents of the archive as it's supposed to. Due to this, the next step that looks for the first file in the archive in the files[0] check. As no files were returned, there is no files[0] in the files list and the error "IndexError: list index out of range" is being returned.
The file is there as you've confirmed, but it couldn't be opened.
Reference to bug/issue:
https://forum.kodi.tv/showthread.php?tid=323321&page=3
As per your second log where you pointed to the temp directory rather than the zip file - which doesn't work as per explanation above, this error message may hint at the problem though:
The encoding looks wrong with the forward slashes converted into %2f of the filesystem path.
I don't have a Kodi on Android system which makes it difficult to replicate and test though.
Can you try to test if either of these two alternatives for line 495 helps in any way:
xbmcvfs is the virtual file system module that's able to work with archive files (with the help of the vfs.libarchive addon) without the need to extract them first. That's why the xbmcvfs.listdir function gets passed the archive file directly rather than a directory. It's meant to return all files and directories in the archive and then copy the first file it finds to the tempdir and proceed checking if it's a supported subtitle file.
The tempdir variable points to the directory with the random numbers that's created in the addon dir while downloading the subtitle archive. The file 'subscene.xxx' in that directory then gets renamed into 'subscene.rar' or 'subscene.zip' or 'subscene.srt' depending on what it is. If it's an archive, on Kodi 19 it uses xbmcvfs to look into the archive file (local_tmp_file variable) and copy the subtitles contained in it into tempdir (next to the archive file) for further processing. If it's Kodi older 19, it extracts the archive using XBMC.Extract (deprecated built-in Kodi function in Kodi 19) for further processing.
It appears, on Android xbmcvfs.listdir and/or vfs.libarchive work differently and listdir does not return the contents of the archive as it's supposed to. Due to this, the next step that looks for the first file in the archive in the files[0] check. As no files were returned, there is no files[0] in the files list and the error "IndexError: list index out of range" is being returned.
Code:
2021-12-26 01:53:25.437 T:20554 ERROR <general>: GetDirectory - Error getting /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/addon_data/service.subtitles.subscene/temp/23f37ed1-38db-496f-aadb-bbbfcc95fc03/subscene.zip
Reference to bug/issue:
https://forum.kodi.tv/showthread.php?tid=323321&page=3
As per your second log where you pointed to the temp directory rather than the zip file - which doesn't work as per explanation above, this error message may hint at the problem though:
Code:
2021-12-26 14:08:42.356 T:7406 ERROR <general>: OnDownloadComplete - Saving of subtitle archive://%2fstorage%2femulated%2f0%2fAndroid%2fdata%2forg.xbmc.kodi%2ffiles%2f.kodi%2fuserdata%2faddon_data%2fservice.subtitles.subscene%2ftemp%2f98ae38f3-58be-4083-9bea-c71e170738de%2fsubscene.zip/ to special://temp/EP.0.v1.1640227727.720p.en failed
I don't have a Kodi on Android system which makes it difficult to replicate and test though.
Can you try to test if either of these two alternatives for line 495 helps in any way:
Code:
(dirs, files) = xbmcvfs.listdir('%s' % urllib.parse.quote_plus(xbmcvfs.translatePath(local_tmp_file)))
(dirs, files) = xbmcvfs.listdir('%s' % xbmcvfs.translatePath(local_tmp_file))