View Full Version : TorrentBrowser3 and Samba
I have played around with the TB3 script and added so the torrent files can be saved on a samba path. Does anyone know if this script is maintained by the author? (I tried to mail him)
Anyhow, if anyone is interested I can post the changes to this topic.
If after a few days you can't contact the author just submit it to xbmcscripts.com Talk with blittan if you want to take ownership of it.
Nuka1195
2007-03-03, 03:55
redsolo, i would be interested in checking out the code for saving to a smb share.
chunk_1970
2007-03-03, 04:59
I posted the smb module some time ago with some test code to browse through samba shares you should be able to find it in the modules section of xbmcscripts. Its quite crude but does allow for full navigation..
I think you could do it with an httpapi command
I got the SMB modules from a samba sample script on http://xbmcscripts.com (search for samba). In that script you will find smb.py and nmb.py. Those two modules are of course required to get the below code to work.
The code, to open a Samba share and store a file to it, looks like this:
try:
smb = SMB(settings['smb_server_name'],settings['smb_server_ip'])
if (smb.is_login_required()):
smb.login(settings['smb_user'], settings['smb_password'])
f=file(FTP_TEMP_FILE,"rb")
smb.stor_file(settings['smb_share'], settings['smb_path'] + '/' + filename,f.read)
f.close()
os.remove(FTP_TEMP_FILE)
del smb
except Exception:
return 'SMB failed'
It is very simple, and there are tons of other things you can do with SMB module.
The only thing I havent understood is why the SMB takes a server name and a server IP. The server name can be anything, but it is required!?!?
Nuka1195
2007-03-03, 16:09
hey, thanks, this could be very handy. i do remember your post now. :)