Enhanced error message
This commit is contained in:
parent
70e0eb7163
commit
9564c87fd7
@ -1,10 +1,10 @@
|
|||||||
#coding:utf8
|
#coding:utf8
|
||||||
|
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
|
import syncplay
|
||||||
common_info = dict(
|
common_info = dict(
|
||||||
name = 'Syncplay',
|
name = 'Syncplay',
|
||||||
version = '0.9',
|
version = syncplay.version,
|
||||||
author = 'Tomasz Kowalczyk, Uriziel',
|
author = 'Tomasz Kowalczyk, Uriziel',
|
||||||
author_email = 'code@fluxid.pl, urizieli@gmail.com',
|
author_email = 'code@fluxid.pl, urizieli@gmail.com',
|
||||||
description = 'Syncplay',
|
description = 'Syncplay',
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
version = '0.2.0'
|
||||||
|
milestone = 'Clara'
|
||||||
|
projectURL = ''
|
||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from .utils import ArgumentParser
|
from .utils import ArgumentParser
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
import syncplay
|
||||||
|
|
||||||
from twisted.protocols.basic import LineReceiver
|
from twisted.protocols.basic import LineReceiver
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ class CommandProtocol(LineReceiver):
|
|||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
|
|
||||||
def dropWithError(self, error):
|
def dropWithError(self, error):
|
||||||
self.sendMessage('error', error)
|
self.sendMessage('error', syncplay.version, error)
|
||||||
self.drop()
|
self.drop()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import re
|
|||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet.protocol import Factory
|
from twisted.internet.protocol import Factory
|
||||||
|
|
||||||
@ -27,11 +28,11 @@ class SyncServerProtocol(CommandProtocol):
|
|||||||
|
|
||||||
def handle_init_iam(self, args):
|
def handle_init_iam(self, args):
|
||||||
if not len(args) == 1:
|
if not len(args) == 1:
|
||||||
self.drop_with_error('Invalid arguments')
|
self.dropWithError('Invalid arguments')
|
||||||
return
|
return
|
||||||
name = re.sub('[^\w]','',args[0])
|
name = re.sub('[^\w]','',args[0])
|
||||||
if not name:
|
if not name:
|
||||||
self.drop_with_error('Invalid nickname')
|
self.dropWithError('Invalid nickname')
|
||||||
return
|
return
|
||||||
self.factory.add_watcher(self, name)
|
self.factory.add_watcher(self, name)
|
||||||
self.change_state('connected')
|
self.change_state('connected')
|
||||||
@ -51,7 +52,7 @@ class SyncServerProtocol(CommandProtocol):
|
|||||||
def handle_connected_state(self, args):
|
def handle_connected_state(self, args):
|
||||||
args = self.__parse_state(args)
|
args = self.__parse_state(args)
|
||||||
if not args:
|
if not args:
|
||||||
self.drop_with_error('Malformed state attributes')
|
self.dropWithError('Malformed state attributes')
|
||||||
return
|
return
|
||||||
counter, ctime, paused, position, _ = args
|
counter, ctime, paused, position, _ = args
|
||||||
self.factory.update_state(self, counter, ctime, paused, position)
|
self.factory.update_state(self, counter, ctime, paused, position)
|
||||||
@ -72,7 +73,7 @@ class SyncServerProtocol(CommandProtocol):
|
|||||||
ctime = int(ctime)
|
ctime = int(ctime)
|
||||||
position = int(position)
|
position = int(position)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.drop_with_error('Invalid arguments')
|
self.dropWithError('Invalid arguments')
|
||||||
|
|
||||||
ctime /= 1000.0
|
ctime /= 1000.0
|
||||||
position /= 1000.0
|
position /= 1000.0
|
||||||
@ -85,7 +86,7 @@ class SyncServerProtocol(CommandProtocol):
|
|||||||
try:
|
try:
|
||||||
ctime = int(ctime)
|
ctime = int(ctime)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.drop_with_error('Invalid arguments')
|
self.dropWithError('Invalid arguments')
|
||||||
|
|
||||||
ctime /= 100000.0
|
ctime /= 100000.0
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from __future__ import print_function
|
|||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import syncplay
|
||||||
class ConsoleUI(threading.Thread):
|
class ConsoleUI(threading.Thread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.promptMode = threading.Event()
|
self.promptMode = threading.Event()
|
||||||
@ -87,4 +88,7 @@ class ConsoleUI(threading.Thread):
|
|||||||
self.showMessage( "\ts+ [time] - seek to: current position += time" )
|
self.showMessage( "\ts+ [time] - seek to: current position += time" )
|
||||||
self.showMessage( "\tr - revert last seek" )
|
self.showMessage( "\tr - revert last seek" )
|
||||||
self.showMessage( "\tp - toggle pause" )
|
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" )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user