Broadcaster: Broadcast action doesn't use default port

This is where you report any issues if you are running a beta version of EventGhost
Forum rules
To submit a possible bug report please follow this template

Version: 0.5 beta 2 (the version you are running)
Traceback: Traceback (most recent call last):
File "<SOME_EVENTGHOST_FILE.py>", line 10, in <module>
SOME_FUNCTION()
File "<SOME_EVENTGHOST_FILE.py>", line 4, in SOME_EVENTGHOST_MODULE
SOME_FUNCTION()

copy and past any traceback information from the log if there is no traceback put NONE

Event:
Main.test.0.1.2.3.4.5.6.7.8
1
2

in the Event field you will want to put the event that was triggered just prior to the traceback occurring, if there is personal data put PERSONAL DATA if there was no traceback or no event triggered right before the traceback put NO EVENT

Description: if you have the ability to replicate the issue then put in here a description of what you are doing to create the problem.

Screen Shots: screen shots of the error and any events/macros/acrions that were run before the issue or screen shots of the problem

Files: any files that may be used to isolate where the issue is. something like the log.txt file would go here

if you provide the above information before hand it will greatly speed up the diagnostic process. we will not have to ask for the bits and pieces. And also having a well formatted Bug Report filled out will get answered sooner then the ones that aren't
Post Reply
User avatar
Boolean263
Plugin Developer
Posts: 81
Joined: Sat Aug 12, 2017 7:52 pm
Location: Ottawa, Canada
Contact:

Broadcaster: Broadcast action doesn't use default port

Post by Boolean263 » Thu Sep 28, 2017 1:04 am

Working away on documenting more plugins, I've gotten to Broadcaster. The Broadcast action is supposed to use the plugin's configured port (default of 33333) if the action is configured to use port 0. In practice, this doesn't seem to be happening.

I believe the bug is here:

Code: Select all

    def bcastSend(self, eventString, payload="", port=0):
        if (port==None):
            sendToPort=self.plugin.port
        else:
            sendToPort=int(port)
        ...
The function's default port is 0, and 0 is also the value supplied by the configuration dialog by default. Thus port==None is never true (because 0 != None), so sendToPort will be set to 0, and never to self.plugin.port .

The easy fix is to change line 196 to `if (port==0):` , but some might say it's more "pythonic" to write something like this instead:

Code: Select all

    def bcastSend(self, eventString, payload="", port=0):
        sendToPort=int(port) if port else self.plugin.port
since port will be a True value as long as it's not 0, None, or False.

Again, I'm not sure if this bug is specific to the beta, but since I'm using the beta, it seems safer to report it here.
Windows 10 Home, version 1703, build 15063.540 · EventGhost 0.5.0-rc4 · wxPython 3.0.2.0
Python programmer for fun and profit. Dabbler in EventGhost plugin writing. Wiki gardener. General geek.

User avatar
topix
Experienced User
Posts: 415
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Broadcaster: Broadcast action doesn't use default port

Post by topix » Thu Sep 28, 2017 7:56 pm

From reading the source i think you're right. And i would also use sendToPort=int(port) if port else self.plugin.port.
In addition i would change line 216 from

Code: Select all

def Configure(self, command="", payload="", port=""):
to

Code: Select all

def Configure(self, command="", payload="", port=0):

User avatar
kgschlosser
Site Admin
Posts: 4209
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Broadcaster: Broadcast action doesn't use default port

Post by kgschlosser » Thu Sep 28, 2017 8:10 pm

I concur
If you like the work I have been doing then feel free to Image

Post Reply