awasu.user
Posts: 82
Joined: Fri Jan 06, 2017 12:50 pm

Postby awasu.user » Sun Sep 03, 2017 10:32 am

Is a posibility change channel name when Awasu is running? I think about edition .channel file, but it will be working? I want for search agent channel change his name based on content which was get from Awasu DB by internal search engine:D Yes, it is not sound complicated :)

User avatar
support
Site Admin
Posts: 3022
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Sun Sep 03, 2017 11:03 am

It's not recommended, but yes, you can edit a .CHANNEL file, but only when Awasu is not running.

The recommended way is to use the $/channels/update API call, sending the fields you want to change as the POST data. The format of this XML is the same as what Awasu returns when you call $/channels/list.

So, to change a channel's name:

Code: Select all

url = "http://localhost:2604/channels/update?id=..."
data = """<channel>
<name> new name </name>
</channel>"""

resp = urllib2.urlopen( url , data=data )
print resp.read()

awasu.user
Posts: 82
Joined: Fri Jan 06, 2017 12:50 pm

Postby awasu.user » Sun Sep 03, 2017 11:14 am

Thank you! Is a posible get hook before channel is updated?

User avatar
support
Site Admin
Posts: 3022
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Sun Sep 03, 2017 11:45 am

A channel hook can be invoked when the channel's configuration is changed (event name ChannelConfigChanged).

Take a look at the sample LogChannelActivity hook to get a feel for how these things work - it shows what events trigger channel hooks, and what information Awasu passes through.

User avatar
support
Site Admin
Posts: 3022
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Sun Sep 03, 2017 11:52 am

Or if you meant when a channel updates its feed, events BeginChannelUpdate and EndChannelUpdate are raised before and after :)


Return to “Awasu - Extensions”

Who is online

Users browsing this forum: No registered users and 4 guests