My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
ExtendingOSTV  
This page explains the structure of OSTV and how it can be extended.
Phase-Implementation, Phase-Design
Updated Sep 9, 2009 by manzanit...@gmail.com

Extending OSTV

More detail will be added here if interest warrants it.

Just about everything OSTV does is a plugin. There is a main file, ostv, in /usr/bin and the code for each area of functionality in ~/.ostv/class. Each of these files is included whenever OSTV runs.

To extend OSTV you copy your plugin to the /class directory. By placing some simple markup in the ~/.ostv/menu/* directories that mirror the OSTV menus the commands to run your plugin will be in the menu. This markup are MPlayer commands in the MPlayer menus to be executed when selected. The MPlayer menu command "run" will run an external command, such as an OSTV command. The OSTV commands or functions do a variety of things, but quite often they send instructions back to MPlayer through a pipe. The markup files have identical names as the plugin making for a simple install/uninstall. OSTV actually builds the menus dynamically from those directories. An optional function the same name as your class will be run at OSTV boot, acting as a constructor function. This can be used to dynamically create menus. That is the only thing this has been used for so far.

OSTV does not have a main loop, it pretty much sends a discrete action, or an ostv function to MPlayer and finishes. To maintain persistent states and keep track of things the main ostv file has a helper function that saves variables permanently in memory(~/.ostv/vars). This function is called p(), because it is somewhat like a pointer in C.

If you interested in getting deeper into how OSTV works, there are a lot of comments in the in /usr/bin/ostv and in the ~/.ostv/class files. Some of them should probably be removed! but others may be helpful.

What language does OSTV use for plugins? Anything! If it runs on your computer it will work as plugin. OSTV is scripted in Bash, so it can call anything you've got. For instance the Bittorent plugin uses mostly bash but also a small Python script.


Sign in to add a comment
Powered by Google Project Hosting