1717# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1919# THE SOFTWARE.
20+
2021import logging
2122import socket
2223from threading import Thread
23- from typing import Optional , Dict , AnyStr , Callable , Any , List
24+ from typing import Any , AnyStr , Callable , Dict , List , Optional
2425
2526from .animation_data import AnimationData
2627from .animation_info import AnimationInfo
@@ -78,7 +79,7 @@ def end(self) -> 'AnimationSender':
7879
7980 return self
8081
81- def send_animation (self , animation_json : AnyStr ) -> 'AnimationSender' :
82+ def send_data (self , animation_json : AnyStr ) -> 'AnimationSender' :
8283 """Send a new animation to the server"""
8384 json_bytes = bytearray (animation_json , 'utf-8' )
8485 self .connection .sendall (json_bytes )
@@ -98,6 +99,9 @@ def parse_data(self):
9899 # they are split up with triple semicolons)
99100 # TODO: Support partial data
100101 for split_input in all_input .split (DELIMITER ):
102+ if len (split_input ) == 0 :
103+ continue
104+
101105 if self .receiveCallback :
102106 self .receiveCallback (split_input )
103107
@@ -141,7 +145,7 @@ def parse_data(self):
141145 pass # TODO
142146
143147 else :
144- logging .warning ('Unrecognized data type: {}' .format (split_input [:4 ]))
148+ logging .warning ('Unrecognized data type: {} ({}) ' .format (split_input [:4 ], split_input ))
145149
146150 except socket .timeout :
147151 pass
0 commit comments