2012-06-07, 15:56
(2012-06-05, 22:27)snavaro Wrote:(2012-06-05, 22:14)vikjon0 Wrote: I am not sure exactly what you mean but you should call delete_file(file) where file is a s string containing the path.
http://docs.python.org/library/os.html
If it does nothing but do not crash I assume it did not pass the if os.path.exists(file):
I suggest that you insert a few print ("hello") to see what goes on.
If it does not run I would suspect that it cannot import the xbmc stuff and I would remove that for now and start with
import os
def delete_file(file):
if os.path.exists(file):
os.remove(file)
used like
delete_file("C:\movies\mymovie,avi")
Here is what I have so far:
Code:import xbmc, xbmcgui, os, sys
file = xbmcgui.ListItem.FilenameAndPath
def delete_file(file):
if os.path.exists(file):
os.remove(file)
xbmc.executebuiltin("XBMC.CleanLibrary(video)")
I presume that the variable named "file" needs to pull a string value from the active window, but I am not at all sure that my syntax is correct. In fact, this does NOT work, as it says that FileNameAndPath is not a proper attribute. I will stick a few print statements in to see where it is getting hung up.
I have tried numerous variations for file=xbmcgui.ListItem.FileNameAndPath code, but am still getting syntax errors. Can anyone help me or point me to documentation that would pull this info from the active window?