Hi, I'm trying to write item plugin that would erase all files older than 1 day in directory. I'have made almost a copy of example in plugin_writting_howto, but get error:
AttributeError: PluginInterface instance has no attribute 'delete_older' ... Code is ---------------------------------------------------------------- import os import plugin import time class PluginInterface(plugin.ItemPlugin): """ Plugin to delete older than 1 day files from security cam directory """ def actions(self, item): # self.item = item if item.mode == 'file' and item.parent.type == 'dir' and item.parent.dir == '/media/motion_video/Web_Camera': return [ (self.delete_older() , 'Delete older than 1 day') ] else: return [] def delete_older(self, menuw=None, arg=None ): item = arg now = int(time.time()) cutoff = now - (1 * 24 * 60 * 60) (head, tail) = split(item.filename) if os.path.isdir(head): contents = os.listdir(head) for name in contents: name1 = os.path.join(head, name) if os.path.isfile(name1): if os.path.getmtime(name1) <= cutoff: os.system('rm "%s" ' % name1) print "Deleting %s \n" % name1 menuw.back_one_menu() ----------------------------------------------------------- Thanks in advance, Robert. ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Freevo-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-devel