Page 1 of 1

Changing channel name on the fly

Posted: Sun Sep 03, 2017 10:32 am
by awasu.user
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 :)

Re: Changing channel name on the fly

Posted: Sun Sep 03, 2017 11:03 am
by support
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()

Re: Changing channel name on the fly

Posted: Sun Sep 03, 2017 11:14 am
by awasu.user
Thank you! Is a posible get hook before channel is updated?

Re: Changing channel name on the fly

Posted: Sun Sep 03, 2017 11:45 am
by support
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.

Re: Changing channel name on the fly

Posted: Sun Sep 03, 2017 11:52 am
by support
Or if you meant when a channel updates its feed, events BeginChannelUpdate and EndChannelUpdate are raised before and after :)