Posted on Saturday 4 July 2009
is it possible to write files to a share (phyton script)?
smb://passord@10.0.0.6/f/musikk/
could someone give me a hand with that smb lib? i'm trying to write a random player for video files i have on my pc, but i can't even get the list of shared folders/files. here's my script:
import xbmc
import smb
f = open('q:\\scripts\\filelist.txt','w') # output file
remote = smb.smb('doghouse', '192.168.7.2')
f.write(remote.get_server_os()) # just to check if the connection works
shared = remote.list_shared()
for d in shared:
f.write(d.get_name())
f.close()
this should get me a list of all shared folders on that machine, but all i'm getting is an empty filelist.txt file. i don't even know whether the connection is working. :help:
any help would be greatly appreciated! thanks in advance!
i guess i will need a lib like
http://miketeo.net/projects/pysmb/
to be able to do what i'm talking about.
i tested on my xbox now.it works okey ;)
do anyone know of a xbmc script using a such script???
but the ipadress and machinename is still requiered in my tests. i will check out your project to see if you have some tricks i don't know of. anyway one thing i found out using this lib is that it does never return over 30 files and folders!
would be realy nice to have a getdirectory object in the phyonmodule.like the httapi have now. there you can getdirectory of anything xbmc supports.
i have played around with the lib, it really works great on xbox!
the only dumb thing is that i can't resolve the computername by only knowing the ipadressa.
socket.gethostbyaddr('10.0.0.2')
will just give the ('10.0.0.2','','10.0.0.2')
on pc it would give ('nydata','','10.0.0.2')
socket.gethostbyaddr('10.0.0.2')
will work at my pc but not at the xbox
also, have a look in mythtv.py... the connection and nmbservice classes might be of use as examples.
anyway, i could login with user 'guest' and no password, but now besides the shared folders, list_shared() is returning all of my pc's drive letters plus two other names: admin$ and ipc$ - well, i can get rid of these unwanted entries if i ignore the strings with $, but i just wanted to know if this is normal or if i'm still doing something wrong.
#If you have any other info about this subject , Please add it free.# |