New version
Index: src/plugins/movequeue.py
===================================================================
--- src/plugins/movequeue.py (revision 0)
+++ src/plugins/movequeue.py (revision 0)
@@ -0,0 +1,119 @@
+import os
+import plugin
+import config
+
+import rc
+import event
+
+from gui import ConfirmBox
+from gui.PopupBox import PopupBox
+from item import Item
+import config, menu, rc, plugin, osd, util
+
+class PluginInterface(plugin.MainMenuPlugin):
+ """
+ Video File Mover With Queue
+
+ Activate:
+ plugin.activate('video.movequeue')
+ """
+ def __init__(self):
+ if not hasattr(config, 'VIDEO_QUEUE_DIR'):
+ self.reason = 'VIDEO_QUEUE_DIR not defined'
+ return
+ plugin.MainMenuPlugin.__init__(self)
+
+ def items(self, parent):
+ return [ VideoQueueMainMenu(parent) ]
+
+
+class QueueItem(Item):
+ """
+ Item for the menu
+ """
+ def __init__(self, parent):
+ Item.__init__(self, parent)
+
+ def actions(self):
+ """
+ return a list of actions for this item
+ """
+ return [ ( self.runcmd , _('Run Command') ) ]
+
+ def runcmd(self, arg=None, menuw=None):
+ """
+ Run Move Command
+ """
+ if self.function == 'move_queue':
+ queue_items = open('/tmp/video_move_queue','r')
+ popup = PopupBox(text=_('Moving queued files..'))
+ popup.show()
+ for line in queue_items:
+ os.system('mv "%s" "%s"' % (line[:-1], config.VIDEO_QUEUE_DIR))
+ queue_items.close()
+ os.system('echo > /tmp/video_move_queue')
+ popup.destroy()
+ else:
+ what = _('Delete from queue?')
+ ConfirmBox(text=what, handler=self.delete_from_queue,
default_choice=1).show()
+ return
+
+ def delete_from_queue(self, arg=None, menuw=None):
+ new_file = ''
+ index = 0
+ delete_item = open('/tmp/video_move_queue','r')
+ for line in delete_item.readlines():
+ index = index + 1
+ if index <> self.index:
+ new_file += line
+ delete_item.close
+ delete_item = open('/tmp/video_move_queue', 'w')
+ delete_item.write(new_file)
+ delete_item.close()
+ #
+ # really, really bad hack to redraw menu
+ #
+ rc.post_event(event.MENU_BACK_ONE_MENU)
+ rc.post_event(event.MENU_SELECT)
+
+ return
+
+class VideoQueueMainMenu(Item):
+ """
+ this is the item for the main menu.
+ """
+ def __init__(self, parent):
+ Item.__init__(self, parent)
+ self.name = _('Video Mover Queue')
+
+ def actions(self):
+ """
+ return a list of actions for this item
+ """
+ items = [ ( self.create_queue_menu , _('Video Mover Queue' )) ]
+ return items
+
+ def create_queue_menu(self, arg=None, menuw=None):
+ queue_item = []
+ queue_menu_items = []
+ index = 0
+ queue_item = QueueItem(self)
+ queue_item.name = 'Move Queue Now'
+ queue_item.function = 'move_queue'
+ queue_item.index = 0
+ queue_menu_items += [ queue_item ]
+ queue_items = open('/tmp/video_move_queue','r')
+ for line in queue_items:
+ queue_item = QueueItem(self)
+ queue_item.name = line
+ queue_item.function = 'sub_menu'
+ index += 1
+ queue_item.index = index
+ queue_menu_items += [ queue_item ]
+ queue_items.close()
+ if (len(queue_menu_items) == 0):
+ queue_menu_items += [menu.MenuItem(_('No queued items found'),
menuw.goto_prev_page, 0)]
+ queue_menu = menu.Menu(_('Video Mover Queue'), queue_menu_items)
+ menuw.pushmenu(queue_menu)
+ menuw.refresh()
+
Index: src/video/plugins/movequeuehelper.py
===================================================================
--- src/video/plugins/movequeuehelper.py (revision 0)
+++ src/video/plugins/movequeuehelper.py (revision 0)
@@ -0,0 +1,22 @@
+import os
+import plugin
+import config
+
+class PluginInterface(plugin.ItemPlugin):
+
+ def __init__(self):
+ plugin.ItemPlugin.__init__(self)
+
+ #Actions:
+ def actions(self,item):
+ self.item = item
+ return [ (self.queue_to_move, 'Add to queue to be moved')]
+
+ def queue_to_move(self,arg=None, menuw=None):
+ item = self.item
+ f = file('/tmp/video_move_queue', 'a')
+ f.write(item.filename)
+ f.write('\n')
+ f.close()
+ menuw.delete_menu(arg, menuw)
+ menuw.refresh()
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel