I've made a small patch/plugin that helps to automaticaly add usb mass storage devices (i.e usb keys) in freevo. This based on the camera.py work. This is really usefull :o) This patch is integrated in the -6mdk package. -- Erwan Velu Linux Cluster Distribution Project Manager MandrakeSoft 43 rue d'aboukir 75002 Paris Phone Number : +33 (0) 1 40 41 17 94 Fax Number : +33 (0) 1 40 41 92 00 Web site : http://www.mandrakesoft.com OpenPGP key : http://www.mandrakesecure.net/cks/
--- src/util/misc.py.old 2003-12-17 12:47:44.000000000 +0100 +++ src/util/misc.py 2003-12-17 12:49:05.000000000 +0100 @@ -270,6 +270,15 @@ fd.close() return devices +def is_usb_storage_device(): + fd = open('/proc/bus/usb/devices', 'r') + for line in fd.readlines(): + if line.lower().find('mass storage') != -1: + fd.close() + return 0 + fd.close() + return -1 + def smartsort(x,y): # A compare function for use in list.sort() """ Compares strings after stripping off 'The' and 'A' to be 'smarter'
#if 0 /* # ----------------------------------------------------------------------- # usb-storage.py - Special handling for usb storage devices # # ----------------------------------------------------------------------- # 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 plugin import util from directory import DirItem class PluginInterface(plugin.MainMenuPlugin): """ Plugin for usb storage devices. Parameter: name and mountpoint.. You should also activate the usb plugin so that the menu will change when you plugin in or remove the usb storage device. Example: plugin.activate('usb') plugin.activate('image.usbstorage', args=('USB Key', '/mnt/hd')) plugin.activate('video.usbstorage', args=('USB Key', '/mnt/hd')) plugin.activate('audio.usbstorage', args=('USB Key', '/mnt/hd')) """ def __init__(self, name, mountpoint): plugin.MainMenuPlugin.__init__(self) self.name = name self.mountpoint = mountpoint def items(self, parent): if util.is_usb_storage_device() != -1: d = DirItem(self.mountpoint, parent, self.name, display_type='image') d.mountpoint = self.mountpoint return [ d ] return []
signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=