enen92 / script.tubecast

A castv1 implementation for Kodi and Youtube
MIT License
109 stars 31 forks source link

Kodi no more detected since random port is used #39

Open PunisherHD92 opened 4 years ago

PunisherHD92 commented 4 years ago

Hello, since this PR: https://github.com/enen92/script.tubecast/pull/33 I'm not able to detect my kodi using android youtube app anymore. The problem is that my Kodi is running on Linux box and it has iptables rules enabled. Previously I allowed incoming traffic to the static port 8008. Now 8008 was replaced with random port, so I can't write a simple firewall rule anymore ... It would be nice to have ability to set a static fixed port in plugin settings, but to let the default to random.

enen92 commented 4 years ago

Already fixed in the last versions

PunisherHD92 commented 4 years ago

Hello, thanks for your reply. I'm using the 1.4.3 version but I still have the issue. Please, could you be more specific about the fix ? How can I force the traffic to go to port 8008 ?

enen92 commented 4 years ago

Sorry, thought this was actually one issue I fixed before (but is actually a feature request)

rijnhard commented 11 months ago

Yup. Still hitting this.... Same issue have to disable my firewall totally for this to work.

prahal commented 10 months ago

I have a local workaround; Edit $HOME/.kodi/addons/script.tubecast/resources/lib/tubecast/chromecast.py: In

   43 class Chromecast(object):
   44 
   45     def __init__(self, monitor):
   46         self._monitor = monitor
   47         self._server_thread = threading.Thread(name="ChromecastServer",
   48                                                target=self._run_server,
   49                                                args=('0.0.0.0', 0))

change the second args=() argument "0" to any port you want to hardcode, say "33456". I.e. args=('0.0.0.0', 33456))

Maybe, at least, Tubecast could show the port it listens on in the settings UI. in the same file, one can add logger.info the following way to log the port to $HOME/.kodi/temp/kodi.log:

   55     def _run_server(self, host, port):
   56         self._server = make_server(host, port, app,
   57                                    server_class=ThreadedWSGIServer,
   58                                    handler_class=SilentWSGIRequestHandler)
   59         logger.info(self._server.server_port)

that log self._server.server_port which is the server port. This will output a line like:

2023-10-14 14:57:43.256 T:2672335    info <general>: [script.tubecast] chromecast: 37861