Update script
#1
Big Grin 
i have pretty everything worked out, but is there anyway to make os.mkdir work in xbmc?
Reply
#2
nevermind, guess it works all by itself.

-mp
Reply
#3
:o
--jaga
Reply
#4
never said i knew what i was doing Huh .

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....
Reply
#5
....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.
Reply
#6
(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?

-mp

**if the authors of the skins and scripts do not want me hosting and sharing them this way, please let me know.
i will.... pm me.. or email...
very cool idea.
Reply
#7
i wanna beta-test the script as well, sounds promising... just pm me or send me a mail.
Reply
#8
Thumbs Up 
i'm in too. pm or email me..

Cool
Reply
#9
Thumbs Up 
i´m in !
pm or email me...

/tilly
Reply
#10
here please Smile

i want to test it for you no problemo :bowdown:

pm me
Reply
#11
same here let take a peek pm or email me :lol:
Reply
#12
me too!!
Reply
#13
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.
Reply
#14
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)
Reply
#15
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.
Reply

Logout Mark Read Team Forum Stats Members Help
Update script0