diff --git a/setup_common.py b/setup_common.py index 92f37f6..5e349a0 100644 --- a/setup_common.py +++ b/setup_common.py @@ -1,10 +1,10 @@ #coding:utf8 from setuptools import find_packages - +import syncplay common_info = dict( name = 'Syncplay', - version = '0.9', + version = syncplay.version, author = 'Tomasz Kowalczyk, Uriziel', author_email = 'code@fluxid.pl, urizieli@gmail.com', description = 'Syncplay', diff --git a/syncplay/__init__.py b/syncplay/__init__.py index e69de29..02e7060 100644 --- a/syncplay/__init__.py +++ b/syncplay/__init__.py @@ -0,0 +1,3 @@ +version = '0.2.0' +milestone = 'Clara' +projectURL = '' \ No newline at end of file diff --git a/syncplay/network_utils.py b/syncplay/network_utils.py index e4ff379..f4c339e 100644 --- a/syncplay/network_utils.py +++ b/syncplay/network_utils.py @@ -2,6 +2,7 @@ from .utils import ArgumentParser from functools import wraps +import syncplay from twisted.protocols.basic import LineReceiver @@ -45,7 +46,7 @@ class CommandProtocol(LineReceiver): self.transport.loseConnection() def dropWithError(self, error): - self.sendMessage('error', error) + self.sendMessage('error', syncplay.version, error) self.drop() diff --git a/syncplay/server.py b/syncplay/server.py index 1e73fb8..4054b85 100644 --- a/syncplay/server.py +++ b/syncplay/server.py @@ -4,6 +4,7 @@ import re import time import random + from twisted.internet import reactor from twisted.internet.protocol import Factory @@ -27,11 +28,11 @@ class SyncServerProtocol(CommandProtocol): def handle_init_iam(self, args): if not len(args) == 1: - self.drop_with_error('Invalid arguments') + self.dropWithError('Invalid arguments') return name = re.sub('[^\w]','',args[0]) if not name: - self.drop_with_error('Invalid nickname') + self.dropWithError('Invalid nickname') return self.factory.add_watcher(self, name) self.change_state('connected') @@ -51,7 +52,7 @@ class SyncServerProtocol(CommandProtocol): def handle_connected_state(self, args): args = self.__parse_state(args) if not args: - self.drop_with_error('Malformed state attributes') + self.dropWithError('Malformed state attributes') return counter, ctime, paused, position, _ = args self.factory.update_state(self, counter, ctime, paused, position) @@ -72,7 +73,7 @@ class SyncServerProtocol(CommandProtocol): ctime = int(ctime) position = int(position) except ValueError: - self.drop_with_error('Invalid arguments') + self.dropWithError('Invalid arguments') ctime /= 1000.0 position /= 1000.0 @@ -85,7 +86,7 @@ class SyncServerProtocol(CommandProtocol): try: ctime = int(ctime) except ValueError: - self.drop_with_error('Invalid arguments') + self.dropWithError('Invalid arguments') ctime /= 100000.0 diff --git a/syncplay/ui/consoleUI.py b/syncplay/ui/consoleUI.py index a7c862e..b93bbe7 100644 --- a/syncplay/ui/consoleUI.py +++ b/syncplay/ui/consoleUI.py @@ -7,6 +7,7 @@ from __future__ import print_function import threading import re import time +import syncplay class ConsoleUI(threading.Thread): def __init__(self): self.promptMode = threading.Event() @@ -87,4 +88,7 @@ class ConsoleUI(threading.Thread): self.showMessage( "\ts+ [time] - seek to: current position += time" ) self.showMessage( "\tr - revert last seek" ) self.showMessage( "\tp - toggle pause" ) - self.showMessage( "\troom [room] - change room, if unspecified go to default" ) + self.showMessage("Syncplay version: %s" % syncplay.version) + self.showMessage("More info available on: %s" % syncplay.projectURL) + else: + self.showMessage( "Unrecognized command, type 'help' for list of available ones" )