i have pretty everything worked out, but is there anyway to make os.mkdir work in xbmc?
2004-11-23, 05:19
never said i knew what i was doing
.
this should be finished up tomorrow or wednesday. run the script and it downloads everything in a directory. great for keeping skins and scripts up to date. im sure there are a few more uses for it....
![Huh Huh](https://forum.kodi.tv/images/smilies/question.png)
this should be finished up tomorrow or wednesday. run the script and it downloads everything in a directory. great for keeping skins and scripts up to date. im sure there are a few more uses for it....
2004-11-25, 02:32
....aaaaand im done :kickass: . xbmsync is complete. this script logs into my ftp server and downloads the latest skins, scripts and stuff. any beta testers out there that want to give this a try?
-mp
**if the authors of the skins and scripts do not want me hosting and sharing them this way, please let me know.
-mp
**if the authors of the skins and scripts do not want me hosting and sharing them this way, please let me know.
2004-11-25, 02:36
(mpauley73 @ nov. 24 2004,16:32 Wrote:....aaaaand im done :kickass: . xbmsync is complete. this script logs into my ftp server and downloads the latest skins, scripts and stuff. any beta testers out there that want to give this a try?i will.... pm me.. or email...
-mp
**if the authors of the skins and scripts do not want me hosting and sharing them this way, please let me know.
very cool idea.
2004-11-26, 11:09
i wanna beta-test the script as well, sounds promising... just pm me or send me a mail.
2004-12-02, 23:36
has anyone tried this out yet?
ftp is a bit of a challenge to program on because the list function does not come out in a standard format - you need to parse the output differently on different ftp server types.
i've got a small ftp python app workin' - if anyone wants to try it out - pm me.
ftp is a bit of a challenge to program on because the list function does not come out in a standard format - you need to parse the output differently on different ftp server types.
i've got a small ftp python app workin' - if anyone wants to try it out - pm me.
2004-12-03, 00:03
i want to apoligize to everyone that i haven't responded to. my pc crashed and work has been keeping me busy. all i have now is an old copy of the script that isnt complete. i'm sorry but i wont have the time to work on this again until after new year. here is the code, i hope someone else can finish it...
Quote:# python xbmc script to download scripts, skins and stuff
#
# this is a basic script that will verify that you want to run it and then just run in the background
installroot = "f:\\apps\\xbmc\\"
import xbmc, xbmcgui, os
from ftplib import ftp
emulating = hasattr(xbmcgui, "emulating")
class remoteobject(object):
"""
abstract superclass. don't instantiate directly.
"""
def (self,filename,parent,delim='/'):
self.filename = filename
self.parent = parent
self.delim = delim
def getpath(self):
"""
method to determine the full path of remoteobject.
"""
currentparent = self.parent
if currentparent is none:
return self.filename
tmppath = ''
delim = self.delim
while currentparent is not none:
tmppath = delim.join([currentparent.filename,tmppath])
currentparent = currentparent.parent
return '%s%s'%(tmppath,self.filename)
class remotedir(remoteobject):
def (self,filename,parent):
remoteobject.(self,filename,parent)
self.contents = []
def retrieve(self,ftp=none,localroot=none):
remotepath = self.getpath()
l = len(remotepath)
remotepath = remotepath[1 : l]
localpath = '%s%s'%(localroot,remotepath)
ftp.retrlines('list %s'%(remotepath),self._rcb)
if not os.path.exists(localpath):
os.mkdir(localpath)
def _rcb(self,line):
"""
callback function for use with ftplib.ftp.retrlines
"""
fname = line.split()[-1]
if line.startswith('d'):
self.contents.append(remotedir(fname,self))
else:
self.contents.append(remotefile(fname,self))
class remotefile(remoteobject):
def (self,name,parent):
remoteobject.(self,name,parent)
def retrieve(self,ftp=none,localroot=none):
remotepath = self.getpath()
localpath = '%s%s'%(localroot,remotepath)
ftp.retrbinary('retr %s'%remotepath,open(localpath,'wb').write)
class ftpretriever(object):
def (self,server='ftp.your_server_name_here.com',username='here',
password='here'):
self.ftp = ftp(server,username,password)
self.container = []
def run(self,remoteroot='/',localroot='ftptmp'):
"""
method to coordinate the work required to
retrieve a directory from an ftp server.
"""
if not os.path.exists(localroot):
os.mkdir(localroot)
root = remotedir(filename=remoteroot,parent=none)
root.retrieve(self.ftp,localroot)
self.container.extend(root.contents)
while self.container:
item = self.container.pop()
item.retrieve(self.ftp,localroot)
try:
self.container.extend(item.contents)
except attributeerror:
continue
if == '':
dialog = xbmcgui.dialog()
selected = dialog.yesno("xbmsync", "are you ready to run xbmsync?")
if selected == true:
if not os.path.exists(installroot):
try:
os.mkdir(installroot)
except:
dialog.ok("error", "failed to created folder")
r = ftpretriever()
r.run(remoteroot='',localroot= installroot)
2004-12-03, 00:16
Quote: def _rcb(self,line):
"""
callback function for use with ftplib.ftp.retrlines
"""
fname = line.split()[-1]
if line.startswith('d'):
self.contents.append(remotedir(fname,self))
else:
self.contents.append(remotefile(fname,self))
which server types have you tested this on?
i found this works as long as there are no spaces in the files/directory/link names.