2016-02-12, 18:57
Sorry for a long an detailed post. We have had a long standing, annoying bug in the wmc addon that I am finally able to investigate now that I can compile Kodi again (yeah!). I think its a bug with Kodi, but so far as I know, no other pvr addons have this problem, so maybe it is just something we are doing wrong. That's why am posting here.
bug description: When a recording starts in the backend, we trigger a refresh of the recording list in our addon so that kodi lists the new recording. When the recording finishes we refresh the recording list again. The problem is, this new recording is not playable when the user clicks it. It only plays if the user clicks another older recording first. After that, the new recording is playable (or they can restart kodi, that also fixes the new recording).
In Kodi I traced it down to this function in File.cpp
The first thing this function does is check to see if the input filepath is in a global directory cache, by calling this code:
and this is where the playback fails for us. The reason is the new file is not found in whatever this internal directory cache is, so g_directoryCache.FileExists returns false, but the directory path of the file is in the directory cache, so bPathInCache is true - so we get kicked out on the 'return false'. To prove it, I can fix our problem easily by forcing bPathInCache false.
So I don't know how this internal directory cache is getting set to the pvr recordings folder and what causes it to not refresh when the backend adds a new file - even though in the addon we are triggering a refresh of the recording list. If no other pvr addons have this problem, I assume we are doing or not doing something in pvr.wmc that is making this happen, but I don't know how either to a) not make our recordings folder part of this internal cache or b) force the internal cache to refresh when a new recording is added.
Any insight on this would be greatly appreciated.
bug description: When a recording starts in the backend, we trigger a refresh of the recording list in our addon so that kodi lists the new recording. When the recording finishes we refresh the recording list again. The problem is, this new recording is not playable when the user clicks it. It only plays if the user clicks another older recording first. After that, the new recording is playable (or they can restart kodi, that also fixes the new recording).
In Kodi I traced it down to this function in File.cpp
Code:
bool CFile::Open(const CURL& file, const unsigned int flags)
The first thing this function does is check to see if the input filepath is in a global directory cache, by calling this code:
Code:
if (!g_directoryCache.FileExists(url2.Get(), bPathInCache) )
{
if (bPathInCache)
return false;
}
and this is where the playback fails for us. The reason is the new file is not found in whatever this internal directory cache is, so g_directoryCache.FileExists returns false, but the directory path of the file is in the directory cache, so bPathInCache is true - so we get kicked out on the 'return false'. To prove it, I can fix our problem easily by forcing bPathInCache false.
So I don't know how this internal directory cache is getting set to the pvr recordings folder and what causes it to not refresh when the backend adds a new file - even though in the addon we are triggering a refresh of the recording list. If no other pvr addons have this problem, I assume we are doing or not doing something in pvr.wmc that is making this happen, but I don't know how either to a) not make our recordings folder part of this internal cache or b) force the internal cache to refresh when a new recording is added.
Any insight on this would be greatly appreciated.