Freevo

 

DevelopPlugins

Site Index:

  1. Intro
  2. Item plugins

Intro

It is quite simple to write your own plugins. Have a look at the code example below. If that didn't scare you away... try looking at some of the code in src/plugins or src/(video|audio|image|games)/plugins and before you blow it you are writing the next fabulous Freevo plugin :-)

Freevo right now has support for special item plugins (more types of plugins will follow) .

Item plugins

You can put your plugins in src/(video|audio|image|games)/plugins to activate the plugin. The interface to freevo needs to be the global function actions with the item as parameter. The function returns a list of possible actions for this item (or an empty list). Each action item is a pair function/description. You can access the function from within the item menu (pressing ENTER not SELECT on the item).

This example plugin will add "move to [seen]" and "delete item" to all video item in the directory /home/dmeyer/video/incoming and is placed in src/freevo/video/plugins

import os  
 
def actions(item): 
    if item.mode == 'file' and item.parent.type == 'dir' and \ 
       item.parent.dir == '/home/dmeyer/video/incoming': 
        return [ (move_to_seen, 'Move to [seen]'), (delete_from_dir, 'Delete item') ] 
    return [] 
 
def move_to_seen(arg=None, menuw=None): 
    item = arg 
    os.system('mv "%s" /home/dmeyer/video/seen' % item.filename) 
    menuw.delete_menu(arg, menuw) 
 
def delete_from_dir(arg=None, menuw=None): 
    item = arg 
    os.system('rm "%s"' % item.filename) 
    menuw.delete_menu(arg, menuw) 

PleaseUpdate add other type of plugins

last edited 2005-01-20 20:16:08 by TanjaStriepling
current version: http://freevo.sourceforge.net/cgi-bin/doc/DevelopPlugins