Changes between Initial Version and Version 1 of Development/1.2/Plugin


Ignore:
Timestamp:
08/27/2009 01:21:55 AM (15 years ago)
Author:
andar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Development/1.2/Plugin

    v1 v1  
     1 
     2== Introduction == 
     3 
     4When considering to write a plugin for Deluge, one must first understand the basic design of Deluge.  Deluge is split in two, the core and the user-interface of which there could be many.  When writing your plugin you will be writing a Core portion and, perhaps, many different UI portions.  This may sound complicated and at times it can be, but it is required to take advantage of Deluge's architecture. 
     5 
     6=== Designing Your Plugin === 
     7 
     8Deluge has the ability to function in a headless environment with only the daemon (Core) portion running.  Various user-interfaces will connect from time to time and view or modify the session, but may not be connected all the time, so the "smarts" of your plugin should reside in the core.  You should also be aware that multiple UIs may be connected at the same time and they will need to behave correctly in terms of your plugin.  Typically, the best place to start writing your plugin is in the Core portion since it will contain most of the plugin logic, with the UI portions typically responsible for displaying and modifying plugin configuration or providing the user with status updates. 
     9 
     10Conceptually you'll want to view your plugin as a collection of separate programs with your UI programs interfacing with your Core program through an RPC interface.  They do not share the same space in memory and may in fact be run on different computers, so information from the Core will need to be accessible to the clients through it's RPC exported functions -- and you can't send any object over this interface, only the basic types. 
     11 
     12== Getting Started == 
     13 
     14The easiest way to get started is to use the [http://svn.deluge-torrent.org/trunk/deluge/scripts/create_plugin.py create_plugin.py] script in the appropriate branch in our SvnRepo.  Alternatively, you can use other plugins as a template for your own if you prefer. 
     15 
     16Running the script: 
     17{{{ 
     18$ python create_plugin.py --name MyPlugin --basepath . --author-name "Your Name" --author-email "yourname@example.com" 
     19}}} 
     20 
     21This should create a directory called `myplugin` under which should be a collection of directories and files which will form the base of your plugin. 
     22 
     23=== Modifying Metadata === 
     24 
     25You may want to change or add some stuff to your plugin's metadata, such as the description or perhaps a URL for your project.  To do this, navigate to your `myplugin` directory and open up the `setup.py` file.  You will see a few different properties and modifying them should be self-explanatory, but you should refrain from changing the plugin name. 
     26 
     27=== Building The Plugin === 
     28 
     29Whenever you want to test out your plugin in Deluge, you will need to build it into an egg. 
     30 
     31First off, navigate to your `myplugin` base directory, you should see a `setup.py` file in there.  Next, run the following command: 
     32{{{ 
     33$ python setup.py bdist_egg 
     34}}} 
     35 
     36It's as simple as that.  You can also use this method to create an egg for distribution to other Deluge users.  The egg will be located in the `dist` directory. 
     37 
     38