List of files on a samba share
#1
hi,
i was trying to get a list of files on a samba share.. i can happily get a list of files doing this:

Quote:for root, dirs, files in os.walk("q:\"):
  [self.list.additem(join(root, name)) for name in files]

but if instead i change "q:\" to a samba share, such as smb://192.168.0.1/share/directory/
it is unable to browse the directory...

i can understand that os.walk wouldn't understand about smb shares, but i was wondering if there was a way i could get such a listing. i was hoping for some api exposed from the xbmc object.

the purpose of this is so i can get a listing of files, and then randomly pick one to play.. the script will later become more complex.... if i hardcode the path to a file i want to open, such as smb://192.168.0.1/share/directory/movie.avi it will play it fine, but trying to get a directory listing is my problem atm.

thanks for any help
andrew
Reply
#2
currently python does not support samba shares (maybe it will be made available later). but iirc there is a python script for xbmc which uses a samba library written in python, you could have a look at that.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
thanks for the reply.

i was hoping for a more general solution that would allow the user to specify any location smb, local, dvd, etc and my python script be able to handle them all the same.

but for now i'll look into this samba library.

thanks
andrew
Reply

Logout Mark Read Team Forum Stats Members Help
List of files on a samba share0