-from enigma import eServiceReference, iServiceInformation
+from enigma import eServiceReference, iServiceInformation, eServiceCenter
from Components.Sources.Source import Source
from Components.config import config
from ServiceReference import ServiceReference
if cmd is not None:
self.cmd = cmd
if self.func is self.DEL:
- self.result = self.delMovieFiles(cmd)
+ self.result = self.delMovie(cmd)
- def delMovieFiles(self,param):
+ def delMovie(self, param):
print "delMovieFiles:", param
if param is None:
- return False,"title missing"
+ return False, "ServiceReference missing"
- #fixme - use eAppContainer!
- try:
- os_system('rm -f "%s"' % param)
- #.ap .cuts .meta
- if os_path.exists("%s.ap" % param):
- os_system('rm -f "%s.ap"' % param)
-
- if os_path.exists("%s.cuts" % param):
- os_system('rm -f "%s.cuts"' % param)
-
- if os_path.exists("%s.meta" % param):
- os_system('rm -f "%s.meta"' % param)
+ service = ServiceReference(param)
+ result = False
+
+ if service is not None:
+ #mostly copied from Screens.MovieSelection
+ serviceHandler = eServiceCenter.getInstance()
+ offline = serviceHandler.offlineOperations(service.ref)
+ info = serviceHandler.info(service.ref)
+ name = info and info.getName(service.ref) or "this recording"
- if os_path.exists("%s.eit" % param):
- os_system('rm -f "%s.eit"' % param)
- except OSError:
- return False,"OSErrorSome error occurred while deleting file"
+ if offline is not None:
+ if not offline.deleteFromDisk(0):
+ result = True
+
+ if result == False:
+ return result, "Could not delete Movie"
+ else:
+ return result, "Movie deleted"
- if os_path.exists(param):
- return False,"Some error occurred while deleting file"
- else:
- return True,"File deleted"
+ return result, "Illegal ServiceReference %s" %(param)
+
+
+
def command(self):
#self.movielist.reload(root=self.root)
}
-function incomingDelMovieFileResult(request) {
- debug("[incomingDelMovieFileResult] called");
+function incomingdelMovieResult(request) {
+ debug("[incomingdelMovieResult] called");
if(request.readyState == 4){
var delresult = new SimpleXMLResult(getXML(request));
if(delresult.getState()){
}
-function delMovieFile(file ,servicename, title, description) {
- debug("[delMovieFile] File(" + file + "), servicename(" + servicename + ")," +
+function delMovie(sref ,servicename, title, description) {
+ debug("[delMovie] File(" + sref + "), servicename(" + servicename + ")," +
"title(" + title + "), description(" + description + ")");
result = confirm( "Are you sure want to delete the Movie?\n" +
"Description: "+description+"\n");
if(result){
- debug("[delMovieFile] ok confirm panel");
- doRequest(url_moviefiledelete+"?filename="+file, incomingDelMovieFileResult, false);
+ debug("[delMovie] ok confirm panel");
+ doRequest(url_moviedelete+"?sRef="+sref, incomingdelMovieResult, false);
return true;
}
else{
- debug("[delMovieFile] cancel confirm panel");
+ debug("[delMovie] cancel confirm panel");
return false;
}
}