Hello community, here is the log from the commit of package python-PyChromecast for openSUSE:Factory checked in at 2020-06-12 21:42:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-PyChromecast (Old) and /work/SRC/openSUSE:Factory/.python-PyChromecast.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PyChromecast" Fri Jun 12 21:42:53 2020 rev:12 rq:814086 version:6.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-PyChromecast/python-PyChromecast.changes 2020-05-28 09:14:47.628692005 +0200 +++ /work/SRC/openSUSE:Factory/.python-PyChromecast.new.3606/python-PyChromecast.changes 2020-06-12 21:44:33.060454792 +0200 @@ -1,0 +2,9 @@ +Thu Jun 11 15:58:53 UTC 2020 - Antonio Larrosa <alarr...@suse.com> + +- Update to 6.0.0: + * BREAKING CHANGE Refactor start_discovery to fix race (#370) + * Support zeroconf 0.27 (#368) + * Don't ignore zeroconf errors (#367) + * BREAKING CHANGE Add support to CastListener for service updates (#366) + +------------------------------------------------------------------- Old: ---- PyChromecast-5.2.0.tar.gz New: ---- PyChromecast-6.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-PyChromecast.spec ++++++ --- /var/tmp/diff_new_pack.0RfA0F/_old 2020-06-12 21:44:34.596454268 +0200 +++ /var/tmp/diff_new_pack.0RfA0F/_new 2020-06-12 21:44:34.596454268 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-PyChromecast -Version: 5.2.0 +Version: 6.0.0 Release: 0 Summary: Python module to talk to Google Chromecast License: MIT ++++++ PyChromecast-5.2.0.tar.gz -> PyChromecast-6.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-5.2.0/PKG-INFO new/PyChromecast-6.0.0/PKG-INFO --- old/PyChromecast-5.2.0/PKG-INFO 2020-05-13 17:29:31.962354000 +0200 +++ new/PyChromecast-6.0.0/PKG-INFO 2020-06-03 08:21:17.728713000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyChromecast -Version: 5.2.0 +Version: 6.0.0 Summary: Python module to talk to Google Chromecast. Home-page: https://github.com/balloob/pychromecast Author: Paulus Schoutsen diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-5.2.0/PyChromecast.egg-info/PKG-INFO new/PyChromecast-6.0.0/PyChromecast.egg-info/PKG-INFO --- old/PyChromecast-5.2.0/PyChromecast.egg-info/PKG-INFO 2020-05-13 17:29:31.000000000 +0200 +++ new/PyChromecast-6.0.0/PyChromecast.egg-info/PKG-INFO 2020-06-03 08:21:17.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyChromecast -Version: 5.2.0 +Version: 6.0.0 Summary: Python module to talk to Google Chromecast. Home-page: https://github.com/balloob/pychromecast Author: Paulus Schoutsen diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-5.2.0/pychromecast/__init__.py new/PyChromecast-6.0.0/pychromecast/__init__.py --- old/PyChromecast-5.2.0/pychromecast/__init__.py 2020-05-13 17:29:15.000000000 +0200 +++ new/PyChromecast-6.0.0/pychromecast/__init__.py 2020-06-03 08:21:09.000000000 +0200 @@ -12,6 +12,7 @@ from . import socket_client from .discovery import ( DISCOVER_TIMEOUT, + CastListener, discover_chromecasts, start_discovery, stop_discovery, @@ -207,7 +208,8 @@ """Stops discovery of new chromecasts.""" stop_discovery(browser) - listener, browser = start_discovery(internal_callback) + listener = CastListener(internal_callback) + browser = start_discovery(listener) return internal_stop diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-5.2.0/pychromecast/discovery.py new/PyChromecast-6.0.0/pychromecast/discovery.py --- old/PyChromecast-5.2.0/pychromecast/discovery.py 2020-05-13 17:29:15.000000000 +0200 +++ new/PyChromecast-6.0.0/pychromecast/discovery.py 2020-06-03 08:21:09.000000000 +0200 @@ -14,10 +14,11 @@ class CastListener: """Zeroconf Cast Services collection.""" - def __init__(self, add_callback=None, remove_callback=None): + def __init__(self, add_callback=None, remove_callback=None, update_callback=None): self.services = {} self.add_callback = add_callback self.remove_callback = remove_callback + self.update_callback = update_callback @property def count(self): @@ -42,11 +43,20 @@ if self.remove_callback: self.remove_callback(name, service) + def update_service(self, zconf, typ, name): + """ Update a service in the collection. """ + _LOGGER.debug("update_service %s, %s", typ, name) + self._add_update_service(zconf, typ, name, self.update_callback) + def add_service(self, zconf, typ, name): """ Add a service to the collection. """ + _LOGGER.debug("add_service %s, %s", typ, name) + self._add_update_service(zconf, typ, name, self.add_callback) + + def _add_update_service(self, zconf, typ, name, callback): + """ Add or update a service. """ service = None tries = 0 - _LOGGER.debug("add_service %s, %s", typ, name) while service is None and tries < 4: try: service = zconf.get_service_info(typ, name) @@ -80,11 +90,11 @@ self.services[name] = (host, service.port, uuid, model_name, friendly_name) - if self.add_callback: - self.add_callback(name) + if callback: + callback(name) -def start_discovery(add_callback=None, remove_callback=None, zeroconf_instance=None): +def start_discovery(listener, zeroconf_instance=None): """ Start discovering chromecasts on the network. @@ -93,43 +103,32 @@ discovered chromecast's zeroconf name. This is the dictionary key to find the chromecast metadata in listener.services. - This method returns the CastListener object and the zeroconf ServiceBrowser - object. The CastListener object will contain information for the discovered - chromecasts. To stop discovery, call the stop_discovery method with the - ServiceBrowser object. + This method returns the zeroconf ServiceBrowser object. + + A CastListener object must be passed, and will contain information for the + discovered chromecasts. To stop discovery, call the stop_discovery method with + the ServiceBrowser object. A shared zeroconf instance can be passed as zeroconf_instance. If no instance is passed, a new instance will be created. """ - listener = CastListener(add_callback, remove_callback) - service_browser = False - try: - service_browser = zeroconf.ServiceBrowser( - zeroconf_instance or zeroconf.Zeroconf(), - "_googlecast._tcp.local.", - listener, - ) - except ( - zeroconf.BadTypeInNameException, - NotImplementedError, - OSError, - socket.error, - zeroconf.NonUniqueNameException, - ): - pass - - return listener, service_browser + return zeroconf.ServiceBrowser( + zeroconf_instance or zeroconf.Zeroconf(), "_googlecast._tcp.local.", listener, + ) def stop_discovery(browser): """Stop the chromecast discovery thread.""" - browser.cancel() + try: + browser.cancel() + except RuntimeError: + # Throws if called from service callback when joining the zc browser thread + pass browser.zc.close() def discover_chromecasts(max_devices=None, timeout=DISCOVER_TIMEOUT): """ Discover chromecasts on the network. """ - browser = False try: # pylint: disable=unused-argument def callback(name): @@ -138,15 +137,15 @@ discover_complete.set() discover_complete = Event() - listener, browser = start_discovery(callback) + listener = CastListener(callback) + browser = start_discovery(listener) # Wait for the timeout or the maximum number of devices discover_complete.wait(timeout) return listener.devices finally: - if browser is not False: - stop_discovery(browser) + stop_discovery(browser) def get_info_from_service(service, zconf): @@ -172,10 +171,10 @@ if ( service_info and service_info.port - and (service_info.server or service_info.address) + and (service_info.server or len(service_info.addresses) > 0) ): - if service_info.address: - host = socket.inet_ntoa(service_info.address) + if len(service_info.addresses) > 0: + host = socket.inet_ntoa(service_info.addresses[0]) else: host = service_info.server.lower() port = service_info.port diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyChromecast-5.2.0/setup.py new/PyChromecast-6.0.0/setup.py --- old/PyChromecast-5.2.0/setup.py 2020-05-13 17:29:15.000000000 +0200 +++ new/PyChromecast-6.0.0/setup.py 2020-06-03 08:21:09.000000000 +0200 @@ -5,7 +5,7 @@ setup( name="PyChromecast", - version="5.2.0", + version="6.0.0", license="MIT", url="https://github.com/balloob/pychromecast", author="Paulus Schoutsen",