xbmcvfs extend #1013

Merged
merged 3 commits into from Jun 2, 2012

Conversation

Projects
None yet
7 participants
@amet
Contributor

amet commented May 25, 2012

repeat of #36 from about a year ago.

extends xbmcvfs functionality and removes SubtitleFileSizeAndHash as its not needed anymore.

Cheers,
amet

@jmarshallnz

This comment has been minimized.

Show comment
Hide comment
@jmarshallnz

jmarshallnz May 25, 2012

Member

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).

Member

jmarshallnz commented May 25, 2012

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).

@MartijnKaijser

This comment has been minimized.

Show comment
Hide comment
@MartijnKaijser

MartijnKaijser May 25, 2012

Member

perhaps a setting that the needs to set to give that add-on explicit permission?

Member

MartijnKaijser commented May 25, 2012

perhaps a setting that the needs to set to give that add-on explicit permission?

@alcoheca

This comment has been minimized.

Show comment
Hide comment
@alcoheca

alcoheca May 26, 2012

Contributor

+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

Contributor

alcoheca commented May 26, 2012

+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

@amet

This comment has been minimized.

Show comment
Hide comment
@amet

amet May 26, 2012

Contributor

@jmarshallnz this is no different than what python does right now. this just mimics that behavior ... same would apply for any python module then

Contributor

amet commented May 26, 2012

@jmarshallnz this is no different than what python does right now. this just mimics that behavior ... same would apply for any python module then

@jmarshallnz

This comment has been minimized.

Show comment
Hide comment
@jmarshallnz

jmarshallnz May 26, 2012

Member

Python has access only locally by default, however. It doesn't have access to non-local files, right?

Member

jmarshallnz commented May 26, 2012

Python has access only locally by default, however. It doesn't have access to non-local files, right?

@PatFrost

This comment has been minimized.

Show comment
Hide comment
@PatFrost

PatFrost May 26, 2012

wow good extend :)

@amet , Possible to create super-mkdir function. same as os.makedirs

"""makedirs(path)

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
recursive.

"""

wow good extend :)

@amet , Possible to create super-mkdir function. same as os.makedirs

"""makedirs(path)

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
recursive.

"""

@PatFrost

This comment has been minimized.

Show comment
Hide comment
@PatFrost

PatFrost May 27, 2012

great :)
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:xbox@192.168.0.2:21/
20:27:18 T:7392 ERROR: XFILE::CDirectory::Exists - Error checking for /ftp://xbox:xbox@192.168.0.2:21/
20:27:18 T:7392 WARNING: XFILE::CDirectoryFactory::Create - Unsupported protocol(/ftp) in /ftp://xbox:xbox@192.168.0.2:21/G/WebDownload/pydocs
20:27:18 T:7392 ERROR: XFILE::CDirectory::Exists - Error checking for /ftp://xbox:xbox@192.168.0.2:21/G/WebDownload/pydocs
"""

great :)
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:xbox@192.168.0.2:21/
20:27:18 T:7392 ERROR: XFILE::CDirectory::Exists - Error checking for /ftp://xbox:xbox@192.168.0.2:21/
20:27:18 T:7392 WARNING: XFILE::CDirectoryFactory::Create - Unsupported protocol(/ftp) in /ftp://xbox:xbox@192.168.0.2:21/G/WebDownload/pydocs
20:27:18 T:7392 ERROR: XFILE::CDirectory::Exists - Error checking for /ftp://xbox:xbox@192.168.0.2:21/G/WebDownload/pydocs
"""

@amet

This comment has been minimized.

Show comment
Hide comment
@amet

amet May 27, 2012

Contributor

@PatFrost please try now

Contributor

amet commented May 27, 2012

@PatFrost please try now

@PatFrost

This comment has been minimized.

Show comment
Hide comment
@PatFrost

PatFrost May 27, 2012

hi amet,

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...

FTP mkdirs
09:16:35 T:6876 ERROR: CUtil::CreateDirectoryExA called with an unsupported path: ftp://xbox:xbox@192.168.0.2:21/G/WebDownload/pydocs/xbmc

FTP listdir
09:16:35 T:6876 ERROR: XFILE::CDirectory::GetDirectory - Error getting ftp://xbox:xbox@192.168.0.2: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" )
f.close()

good job amet
frost

hi amet,

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...

FTP mkdirs
09:16:35 T:6876 ERROR: CUtil::CreateDirectoryExA called with an unsupported path: ftp://xbox:xbox@192.168.0.2:21/G/WebDownload/pydocs/xbmc

FTP listdir
09:16:35 T:6876 ERROR: XFILE::CDirectory::GetDirectory - Error getting ftp://xbox:xbox@192.168.0.2: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" )
f.close()

good job amet
frost

@amet

This comment has been minimized.

Show comment
Hide comment
@amet

amet May 27, 2012

Contributor

@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

Contributor

amet commented May 27, 2012

@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

@amet

This comment has been minimized.

Show comment
Hide comment
@amet

amet May 27, 2012

Contributor

@PatFrost check again, write should be ok.

Contributor

amet commented May 27, 2012

@PatFrost check again, write should be ok.

@PatFrost

This comment has been minimized.

Show comment
Hide comment
@PatFrost

PatFrost May 27, 2012

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 ) ) )
f.close()

result : http://passion-xbmc.org/gros_fichiers/frost/xbmcvfs.html

Thanks amet
I will back tomorrow for more test...
Frost

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 ) ) )
f.close()

result : http://passion-xbmc.org/gros_fichiers/frost/xbmcvfs.html

Thanks amet
I will back tomorrow for more test...
Frost

@amet

This comment has been minimized.

Show comment
Hide comment
@amet

amet May 28, 2012

Contributor

@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 :)

Contributor

amet commented May 28, 2012

@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 :)

@jmarshallnz

This comment has been minimized.

Show comment
Hide comment
@jmarshallnz

jmarshallnz Jun 2, 2012

Member

Looks ok other than that one minor comment issue.

Member

jmarshallnz commented Jun 2, 2012

Looks ok other than that one minor comment issue.

amet added a commit that referenced this pull request Jun 2, 2012

Merge pull request #1013 from amet/vfs_extend
[Python] extend xbmcvfs module with, read, write, seek, close, listdir, mkdirs and remove SubtitleFileSizeAndHash

@amet amet merged commit 5a0237b into xbmc:master Jun 2, 2012

@twinther

This comment has been minimized.

Show comment
Hide comment
@twinther

twinther Jun 6, 2012

Contributor

Hi @amet
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

Br.
Tommy

Contributor

twinther commented Jun 6, 2012

Hi @amet
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

Br.
Tommy

@theuni

This comment has been minimized.

Show comment
Hide comment
@theuni

theuni Jul 7, 2012

Member

@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?

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment