xbmcvfs.exists() broken in Helix?
#1
I have an addon working fine in Gotham but in Helix it fails due to xbmcvfs.exists(my/existing/path) always returns 0.
Am I doing something wrong or are there any changes in the way the xbmcvfs methods work?
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#2
in helix you need to be sure the path ends with a slash:
xbmcvfs.exists(my/existing/path/)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
For directories I assume they have to end in a os.sep (?) , but I cant get it to work even on ordinary files. The path, does it have to be a full URI with scheme (e.g. file://)?
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#4
Ok, I got it working. So for directories lacking slash at the end the result is always false.
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#5
paths without a slash at the end are interpreted as files.
paths with a slash at the end, as folders.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#6
Not got it working, again. Seems like there are some inconsistencies in the returned result. I have a method polling xbmcvfs.exists(path) every second until the path is created (with a trailing slash). Somehow I always get false returned even though I can see the folder being created.
When I in my addon tries to write a file to os.path.join(path,"myfile.txt") it works just fine. Same goes for checking if xbmcvfs.exists(os.path.join(path,"myfile.txt"))
So, are there any cashing ongoing in the xbmcvfs.exists() method?
What are the source code changes? (I'm having a hard time finding where in the source code to look, opengrok would be nice)
btw, just tested on win7
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#7
it's a cache thing, the directory exist call doesn't flip the usecache flag, only the file exist does. see here;

https://github.com/xbmc/xbmc/blob/master...fs.cpp#L57
Reply
#8
Aha, that explains things. Where is the usecache flag set? Tried following the code backwards but I'm quite bad at cpp.
Guess I'll have to try writing a file or something to get around the caching thing..
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#9
just make the exists call CDirectory::Exists(path, false) - like for the file. the function eats an additional parameter, which has a default value of true.
Reply
#10
Well, I'm no core developer so I'll stick with this information and will try figuring out a workaround in python instead. Thanks for the help!
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#11
right, i thought you had a build env and could test before we nag some core dev.
Reply
#12
I had the same issue a few weeks ago, and ronies suggestion to make sure all directories end with a slash solved all my issues...
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#13
Lunatix, the issue turned out not to be trailing slashes but Kodi's caching of directory status.
In my case I know a file should also be present in the dir, so now I'll check for that instead. In other cases, I will try write+remove a dummy file as a poor mans dir check without cache.
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#14
In Kodi Isengard and Jarvis have this same issue. xbmcvfs.exists sometimes return 0 when directory are accessible.
In my addon I want check sources:

Code:
# check source
jsonGetSource = '{"jsonrpc": "2.0", "method": "Files.GetSources", "params": {"media": "video"}, "id": 1}'
jsonGetSource = xbmc.executeJSONRPC(jsonGetSource)
jsonGetSource = unicode(jsonGetSource, 'utf-8', errors='ignore')
jsonGetSourceResponse = json.loads(jsonGetSource)

if 'result' in jsonGetSourceResponse and 'sources' in jsonGetSourceResponse['result']:
    for s in jsonGetSourceResponse['result']['sources']:
        if xbmcvfs.exists(s['file']) == 0:
            debug.debug('Source inaccessible: ' + s['file'].encode('utf-8'))

Some users reported that source not accessible:
Code:
23:39:05 T:2368  NOTICE: >>>> Movielib <<<< Source inaccessible: smb://AURORA/3d_BRISO_1/

I suppose that this is a problem with kodi cache of directory status?
Maybe consider adding a optional parameter true/false in this module to force check directory status ?
Reply
#15
https://github.com/xbmc/xbmc/pull/8531
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcvfs.exists() broken in Helix?0