Channel plugins

The simplest kind of plugin is a channel plugin, so we'll start with one of those. We'll write it in Python, since it's very easy to see what's happening, even if you don't know the language.

The sample code is available on GitHub.

Running a simple channel plugin

Start Awasu, open the Channel Wizard and select the script file python-channel/sample_python_channel.py. When you have finished going through the wizard, Awasu will call this script to generate a feed and show you the results.

The script looks like this:

# set the feed parameters
home_url = "https://test.com"
n_items = 5

# generate the RSS feed
print( "<rss>" )
print( "<channel>" )
print()
print( "<title>Sample Python Channel</title>" )
print( "<link>{}</link>".format( home_url ) )
print( "<description>This is a demo RSS feed generated by the sample Python channel plugin.</description>" )
print()
for i in range( 1, n_items+1 ):
    print( "<item>" )
    print( "    <title>Item {}</title>".format( i ) )
    print( "    <link>{}/item-{}.html</link>".format( home_url, i ) )
    print( "    <description>This is the description for item {}.</description>".format( i ) )
    print( "</item>" )
    print()
print( "</channel>" )
print( "</rss>" )

That's it! Plugins just print out their feed to the console and Awasu will take it from there. We won't go into the details of the exact format of an feed here but it's easy to see how things are organized. Most of the time, you won't need anything more than this.

How plugins are run

A few notes about how plugins are run: