Exemple #1
0
		for tn in ['01','02','03','04','05','06','07','08','09','10']:
			if (tfalse(addst(tn+"-enable","false"))==True):
				tt={}; tt['path']=xbmc.validatePath(xbmc.translatePath(addst(tn+"-path","special://logpath"))) #.replace(pFindWhat,"|tag|").replace("|tag|",pReplaceWith)
				tt['user']=addst(tn+"-user",""); tt['pass']=addst(tn+"-pass","xbmchub"); tt['perm']=addst(tn+"-perm","elradfmwM")
				if (len(tt['user']) > 0) and (len(tt['path']) > 0):
					print "user : "******" : path :"+str(tt['path'])+" :"
					try: authorizer.add_user(tt['user'],tt['pass'],tt['path'],perm=tt['perm'])
					except: print"Error adding user: "******"pyftpdlib based ftpd ready."
		try: LiP=addst("address","")
		except: LiP=""
		try: Lport=int(addst("port","2121"))
		except: Lport=2121
		address=(LiP,Lport); server=FTPServer(address,handler); server.max_cons=int(addst("max-connections","5")); server.max_cons_per_ip=int(addst("max-connections-per-ip","5")); 
		print "Starting Server... Port: "+str(Lport); notification("FTP Server","Starting Server... Port: "+str(Lport))
		#server.serve_forever()
		try: server.serve_forever(timeout=int(addst("timeout","10")),blocking=False)
		except: pass
	elif (STARTUP==False) and (ENABLED==True):
		try: server.serve_forever(timeout=int(addst("timeout","10")),blocking=False)
		except: pass
print "Service While Loop has been exited."; print "isEnabled="+str(ENABLED); print "Attempting to Close Server...."; notification("FTP Server","Attempting to Close Server....")
addstv("is-serivce-running","false")
try: server.ip_map=[]
except: print "failed: server.ip_map=[]"; pass
try: server.socket.close()
except: print "failed: server.socket.close()"; pass
try: server.close_all()
except: pass
sys.exit()