PDA

View Full Version : a little help please


grudge
2006-07-22, 21:06
ok a guy on oxbox-scene forums ;blittan; threw this together for me and im having a little bit of trouble getting it to work, i figured id ask here first since hes busy workin on another project and i dont wanna be a neusance.

this is to make shortcuts for whatever emulator specified for all the roms in the rompath, but it just dies as soon as its launched nothing happens, any help?


import xbmc, xbmcgui, os

# this needs to be changed to the emulator you want the cut for (remember \\ is one \)
emulator = "F:\\emulators\\snes\\default.xbe"
#path to the roms (takes all files)
romPath = "F:\\emulators\\snes\\roms"
# path to thumbnail, otherwise it will use a thumbnail named like the rom (EG: myrom.zip -> myrom.tbn)
thumb = "E:\\Zsnexbox\\prev"

# # # DON'T CHANGE UNDER THIS

def savecut(cut,label,game,thumb):
f = open(cut, "wb")
f.write("<shortcut>\n")
f.write(" <path>"+emulator+"</path>\n")
f.write(" <thumb>"+thumb+"</thumb>\n")
f.write(" <label>"+label+"</label>\n")
f.write(" <custom>\n")
f.write(" <game>"+game+"</game>\n")
f.write(" </custom>\n")
f.write("</shortcut>\n")
f.close()

def listdir(tdir):
global thumb
dl = os.listdir(tdir)
for ret in dl:
if os.path.isdir(tdir+ret):
listdir(tdir+ret)
else:
if ret != 'list.py':
label = ret[:-4]
cut = tdir+label+".cut"
if thumb == '':
thumb = tdir+label+".tbn"
game = tdir+ret
savecut(cut,label,game,thumb)

listdir(romPath)
XBMC.Notification('DONE','Shortcuts created')




any help would be appreciated

Rockstarr
2006-07-22, 23:32
Do you get a errormessage by pressing the white button in Scripts Window?

grudge
2006-07-23, 01:40
no im not getting an error message , just a blank screen. maybe this just is not working with the newest xbmc build?

has anyone else gotten it to work?

maybe i got it in the wrong folder or something..... scripts dir

grudge
2006-07-25, 00:52
ok now ive gotten it to work.... it was just saving the files to the roms folder.... plus i had to change the way it saved the <thumb> line....