Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv14087/plugins
Added Files:
file_ops.py
Log Message:
Move delete file from VideoItem into a global plugin. Now it's also
possible to remove audio and image files.
--- NEW FILE: file_ops.py ---
#if 0 /*
# -----------------------------------------------------------------------
# file_ops.py - Small file operations (currently only delete)
# -----------------------------------------------------------------------
# $Id: file_ops.py,v 1.1 2003/08/31 17:14:21 dischi Exp $
#
# Notes:
# Todo:
#
# -----------------------------------------------------------------------
# $Log: file_ops.py,v $
# Revision 1.1 2003/08/31 17:14:21 dischi
# Move delete file from VideoItem into a global plugin. Now it's also
# possible to remove audio and image files.
#
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ----------------------------------------------------------------------- */
#endif
import os
import config
import plugin
from gui.ConfirmBox import ConfirmBox
TRUE = 1
FALSE = 0
class PluginInterface(plugin.ItemPlugin):
"""
small plugin to delete files
"""
def actions(self, item):
"""
create list of possible actions
"""
if ((item.type == 'video' and item.mode == 'file') or \
item.type in ( 'audio', 'image' )) and not item.media:
self.item = item
return [ (self.confirm_delete, 'Delete file', 'delete') ]
return []
def confirm_delete(self, arg=None, menuw=None):
self.menuw = menuw
ConfirmBox(text='Do you wish to delete\n %s?' % self.item.name,
handler=self.delete_file, default_choice=1).show()
def delete_file(self):
if config.DEBUG:
print 'Deleting %s' % self.filename
if self.item.type in ('video', 'audio'):
base = os.path.splitext(self.item.filename)[0] + '.'
if os.path.isfile(base + 'jpg'):
os.remove(base + 'jpg')
if os.path.isfile(base + 'png'):
os.remove(base + 'png')
if os.path.isfile(self.item.filename):
os.unlink(self.item.filename)
if self.item.type == 'video' and hasattr(self, 'fxd_file') and \
os.path.isfile(self.item.fxd_file) and \
self.item.fxd_file.find(config.MOVIE_DATA_DIR) == -1 and \
self.item.fxd_file.find(config.TV_SHOW_DATA_DIR) == -1 and \
self.item.fxd_file.find(config.TV_SHOW_IMAGE_DIR) == -1:
os.unlink(self.item.fxd_file)
if self.menuw:
self.menuw.back_one_menu(arg='reload')
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog