repeat of #36 from about a year ago.
extends xbmcvfs functionality and removes SubtitleFileSizeAndHash as its not needed anymore.
I think we need to discuss whether we want open slather, or whether we want to permission this somehow.
Not sure the best way to handle the permissions, but it seems reasonable to me that at the very least the user is informed that add-on X has the ability to read your filesystem or that add-on X has the ability to write to your filesystem (delete in this case).
perhaps a setting that the needs to set to give that add-on explicit permission?
+1 on permissions and user's being informed on this. Without a permissions orientated API inplace, you could simulate this using modification to the addon.xml schema (only addons which explicitly require this portion of the xbmc api are allowed access), and a little bit of glue code in addons installer (notifications) and in the vfs module (check against addons db for permission?).
it might seem like work now, but it's beneficial in the long run
@jmarshallnz this is no different than what python does right now. this just mimics that behavior ... same would apply for any python module then
Python has access only locally by default, however. It doesn't have access to non-local files, right?
add CFileUtils::DeleteItem(const CStdString &strPath, bool force)
wow good extend :)
@amet , Possible to create super-mkdir function. same as os.makedirs
Super-mkdir; create a leaf directory and all intermediate ones.
Works like mkdir, except that any intermediate path segment (not
just the rightmost) will be created if it does not exist. This is
but not work, error is start with / and not sure but don't check and create root folder G:
20:23:25 T:6624 ERROR: XFILE::CDirectory::Create - Error creating /G:
20:23:25 T:6624 ERROR: XFILE::CDirectory::Create - Error creating /G:/pydocs
20:23:25 T:6624 ERROR: XFILE::CDirectory::Create - Error creating /G:/pydocs/xbmc
20:23:25 T:6624 ERROR: An error occurred saving xbmcvfs! ([Errno 2] No such file or directory: 'G:\pydocs\xbmc\xbmcvfs.html')
same with ftp or smb
20:35:40 T:7856 WARNING: XFILE::CDirectoryFactory::Create - Unsupported protocol(/smb) in /smb://---/
20:35:40 T:7856 ERROR: XFILE::CDirectory::Exists - Error checking for /smb://---/
20:35:40 T:7856 WARNING: XFILE::CDirectoryFactory::Create - Unsupported protocol(/smb) in /smb://----/Medias/pydocs
20:35:40 T:7856 ERROR: XFILE::CDirectory::Create - Error creating /smb://----//Medias/pydocs
20:27:18 T:7392 WARNING: XFILE::CDirectoryFactory::Create - Unsupported protocol(/ftp) in /ftp://xbox:firstname.lastname@example.org:21/
20:27:18 T:7392 ERROR: XFILE::CDirectory::Exists - Error checking for /ftp://xbox:email@example.com:21/
20:27:18 T:7392 WARNING: XFILE::CDirectoryFactory::Create - Unsupported protocol(/ftp) in /ftp://xbox:firstname.lastname@example.org:21/G/WebDownload/pydocs
20:27:18 T:7392 ERROR: XFILE::CDirectory::Exists - Error checking for /ftp://xbox:email@example.com:21/G/WebDownload/pydocs
@PatFrost please try now
yes it's ok with smb and local location. tested mkdirs, listdir, and File(...).read()
Not work with FTP, others functions work with FTP copy, delete, exists etc...
09:16:35 T:6876 ERROR: CUtil::CreateDirectoryExA called with an unsupported path: ftp://xbox:firstname.lastname@example.org:21/G/WebDownload/pydocs/xbmc
09:16:35 T:6876 ERROR: XFILE::CDirectory::GetDirectory - Error getting ftp://xbox:email@example.com:21/G/WebDownload/pydocs/xbmc
09:16:35 T:6876 NOTICE: (, )
Others request :) possible to add write file
f = xbmcvfs.File(_path)
f.write( "foo" )
good job amet
@PatFrost FTP is read only on XBMC, at least it should be :)
EDIT: see here -> https://github.com/xbmc/xbmc/blob/master/xbmc/Util.cpp#L1182 it only allows for local, SMB/NFS/AFP files... no FTP
@PatFrost check again, write should be ok.
FTP is read only! ok but xbmcvfs.delete(...) deleted a dummy file on my xbox :D I retest tomorrow
:) it's ok for write on smb share
f = xbmcvfs.File( _path, "w" )
print f.write( doc.document( eval( module ) ) )
result : http://passion-xbmc.org/gros_fichiers/frost/xbmcvfs.html
I will back tomorrow for more test...
@PatFrost for some reason mkdirs is limited to the above mentioned protocols, FTP is not one of them unfortunately. I am not sure why, but I am sure there is a valid reason for it :)
Looks ok other than that one minor comment issue.
extend xbmcvfs module with, read, write, seek, close, listdir, mkdirs
remove SubtitleFileSizeAndHash, not needed as xbmcvfs has read/seek f…
I know you already pulled this, but it would be really great to have stat() included as well.
This would solve some problems for me in my TV Guide addon.
Also this feature request in trac can be closed.. http://trac.xbmc.org/ticket/12849
@amet: I segfault unless I also add InitVFSTypes(); to XBPython::InitializeInterpreter. It was a blind c/p, so I have no idea what's going on there. But from the looks, it's safe to assume that's needed?