[Python-modules-commits] [pychromecast] 01/01: Import pychromecast_0.7.7.orig.tar.gz

Ruben Undheim rubund-guest at moszumanska.debian.org
Thu Oct 27 20:16:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch upstream
in repository pychromecast.

commit 6916c07378adb39e775f1b4579dc6a8fcc09c43c
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date:   Thu Oct 27 22:11:11 2016 +0200

    Import pychromecast_0.7.7.orig.tar.gz
---
 pychromecast/__init__.py          |  2 +-
 pychromecast/controllers/media.py | 12 +++++++-----
 pychromecast/socket_client.py     |  8 +++++++-
 setup.py                          |  2 +-
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/pychromecast/__init__.py b/pychromecast/__init__.py
index 3d1914f..083401d 100644
--- a/pychromecast/__init__.py
+++ b/pychromecast/__init__.py
@@ -22,7 +22,7 @@ __all__ = (
     'get_chromecasts', 'get_chromecasts_as_dict', 'get_chromecast',
     'Chromecast'
 )
-__version_info__ = ('0', '7', '1')
+__version_info__ = ('0', '7', '6')
 __version__ = '.'.join(__version_info__)
 
 IDLE_APP_ID = 'E8C28D3C'
diff --git a/pychromecast/controllers/media.py b/pychromecast/controllers/media.py
index f627c9a..fa8c691 100644
--- a/pychromecast/controllers/media.py
+++ b/pychromecast/controllers/media.py
@@ -9,9 +9,10 @@ from . import BaseController
 
 STREAM_TYPE_UNKNOWN = "UNKNOWN"
 STREAM_TYPE_BUFFERED = "BUFFERED"
-STREAM_TYPE_LIVE = "LIFE"
+STREAM_TYPE_LIVE = "LIVE"
 
 MEDIA_PLAYER_STATE_PLAYING = "PLAYING"
+MEDIA_PLAYER_STATE_BUFFERING = "BUFFERING"
 MEDIA_PLAYER_STATE_PAUSED = "PAUSED"
 MEDIA_PLAYER_STATE_IDLE = "IDLE"
 MEDIA_PLAYER_STATE_UNKNOWN = "UNKNOWN"
@@ -73,7 +74,8 @@ class MediaStatus(object):
     @property
     def player_is_playing(self):
         """ Return True if player is PLAYING. """
-        return self.player_state == MEDIA_PLAYER_STATE_PLAYING
+        return (self.player_state == MEDIA_PLAYER_STATE_PLAYING or
+                self.player_state == MEDIA_PLAYER_STATE_BUFFERING)
 
     @property
     def player_is_paused(self):
@@ -449,15 +451,15 @@ class MediaController(BaseController):
 
             msg['media']['metadata']['images'].append({'url': thumb})
         if subtitles:
-            sub_msg = {
+            sub_msg = [{
                 'trackId': subtitle_id,
                 'trackContentId': subtitles,
                 'language': subtitles_lang,
                 'subtype': 'SUBTITLES',
                 'type': 'TEXT',
-                'ttrackContentType': subtitles_mime,
+                'trackContentType': subtitles_mime,
                 'name': "{} - {} Subtitle".format(subtitles_lang, subtitle_id)
-                }
+                }]
             msg['media']['tracks'] = sub_msg
         self.send_message(msg, inc_session_id=True)
 
diff --git a/pychromecast/socket_client.py b/pychromecast/socket_client.py
index ee76f9e..51c06d6 100644
--- a/pychromecast/socket_client.py
+++ b/pychromecast/socket_client.py
@@ -78,7 +78,13 @@ class InterruptLoop(Exception):
 
 def _json_from_message(message):
     """ Parses a PB2 message into JSON format. """
-    return json.loads(message.payload_utf8)
+    try:
+        return json.loads(message.payload_utf8)
+    except ValueError:
+        logger = logging.getLogger(__name__)
+        logger.warning("Ignoring invalid json in namespace %s: %s",
+                       message.namespace, message.payload_utf8)
+        return {}
 
 
 def _message_to_string(message, data=None):
diff --git a/setup.py b/setup.py
index 6bccf0f..dd9043a 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ long_description = open('README.rst').read()
 
 setup(
     name='PyChromecast',
-    version='0.7.4',
+    version='0.7.7',
     license='MIT',
     url='https://github.com/balloob/pychromecast',
     author='Paulus Schoutsen',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pychromecast.git



More information about the Python-modules-commits mailing list