1 from Plugins.Plugin import PluginDescriptor
2 from Components.Scanner import scanDevice
5 print "execute", option
9 (_, scanner, files, session) = option
10 scanner.open(files, session)
12 def mountpoint_choosen(option):
16 from Screens.ChoiceBox import ChoiceBox
18 (description, mountpoint, session) = option
19 res = scanDevice(mountpoint)
21 list = [ (r.description, r, res[r], session) for r in res ]
25 from Screens.MessageBox import MessageBox
26 session.open(MessageBox, "No displayable files on this medium found!", MessageBox.TYPE_ERROR)
29 session.openWithCallback(execute, ChoiceBox,
30 title = "The following files were found...",
34 from Screens.ChoiceBox import ChoiceBox
36 from Components.Harddisk import harddiskmanager
38 parts = [ (r.description, r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
40 session.openWithCallback(mountpoint_choosen, ChoiceBox, title = _("Please Select Medium to be Scanned"), list = parts)
42 def main(session, **kwargs):
46 mountpoint_choosen(args)
49 if menuid != "mainmenu":
52 from Components.Harddisk import harddiskmanager
53 from Tools.BoundFunction import boundFunction
54 return [(("%s (files)") % r.description, boundFunction(menuEntry, r.description, r.mountpoint), "hotplug_%s" % r.mountpoint, None) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
56 def Plugins(**kwargs):
57 return [ PluginDescriptor(name="MediaScanner", description="Scan Files...", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main),
58 PluginDescriptor(where = PluginDescriptor.WHERE_MENU, fnc=menuHook)]