diff --git a/tools/debug-proxy.py b/tools/debug-proxy.py index 2f54ea36..4fb39b5b 100755 --- a/tools/debug-proxy.py +++ b/tools/debug-proxy.py @@ -6,7 +6,7 @@ import sys from gevent import select, server, socket -COLORS = ['\033[1;%dm' % (30+i) for i in range(8)] +COLORS = ['\033[1;%dm' % (30 + i) for i in range(8)] BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = COLORS RESET = "\033[0m" BOLD = "\033[1m" @@ -53,7 +53,8 @@ def loop(client, address, reference, actual): # Consume banners from backends responses = dict() - disconnected = read([reference, actual], responses, find_response_end_token) + disconnected = read( + [reference, actual], responses, find_response_end_token) diff(address, '', responses[reference], responses[actual]) # We lost a backend, might as well give up. @@ -78,13 +79,15 @@ def loop(client, address, reference, actual): actual.sendall(responses[client]) # Get the entire resonse from both backends. - disconnected = read([reference, actual], responses, find_response_end_token) + disconnected = read( + [reference, actual], responses, find_response_end_token) # Send the client the complete reference response client.sendall(responses[reference]) # Compare our responses - diff(address, responses[client], responses[reference], responses[actual]) + diff(address, + responses[client], responses[reference], responses[actual]) # Give up if we lost a backend. if disconnected: diff --git a/tools/idle.py b/tools/idle.py index aa56dce2..fc9cb021 100644 --- a/tools/idle.py +++ b/tools/idle.py @@ -17,98 +17,98 @@ data = {'id': None, 'id2': None, 'url': url, 'artist': artist} # Commands to run before test requests to coerce MPD into right state setup_requests = [ - 'clear', - 'add "%(url)s"', - 'add "%(url)s"', - 'add "%(url)s"', - 'play', -# 'pause', # Uncomment to test paused idle behaviour -# 'stop', # Uncomment to test stopped idle behaviour + 'clear', + 'add "%(url)s"', + 'add "%(url)s"', + 'add "%(url)s"', + 'play', + #'pause', # Uncomment to test paused idle behaviour + #'stop', # Uncomment to test stopped idle behaviour ] # List of commands to test for idle behaviour. Ordering of list is important in # order to keep MPD state as intended. Commands that are obviously # informational only or "harmfull" have been excluded. test_requests = [ - 'add "%(url)s"', - 'addid "%(url)s" "1"', - 'clear', -# 'clearerror', -# 'close', -# 'commands', - 'consume "1"', - 'consume "0"', -# 'count', - 'crossfade "1"', - 'crossfade "0"', -# 'currentsong', -# 'delete "1:2"', - 'delete "0"', - 'deleteid "%(id)s"', - 'disableoutput "0"', - 'enableoutput "0"', -# 'find', -# 'findadd "artist" "%(artist)s"', -# 'idle', -# 'kill', -# 'list', -# 'listall', -# 'listallinfo', -# 'listplaylist', -# 'listplaylistinfo', -# 'listplaylists', -# 'lsinfo', - 'move "0:1" "2"', - 'move "0" "1"', - 'moveid "%(id)s" "1"', - 'next', -# 'notcommands', -# 'outputs', -# 'password', - 'pause', -# 'ping', - 'play', - 'playid "%(id)s"', -# 'playlist', - 'playlistadd "foo" "%(url)s"', - 'playlistclear "foo"', - 'playlistadd "foo" "%(url)s"', - 'playlistdelete "foo" "0"', -# 'playlistfind', -# 'playlistid', -# 'playlistinfo', - 'playlistadd "foo" "%(url)s"', - 'playlistadd "foo" "%(url)s"', - 'playlistmove "foo" "0" "1"', -# 'playlistsearch', -# 'plchanges', -# 'plchangesposid', - 'previous', - 'random "1"', - 'random "0"', - 'rm "bar"', - 'rename "foo" "bar"', - 'repeat "0"', - 'rm "bar"', - 'save "bar"', - 'load "bar"', -# 'search', - 'seek "1" "10"', - 'seekid "%(id)s" "10"', -# 'setvol "10"', - 'shuffle', - 'shuffle "0:1"', - 'single "1"', - 'single "0"', -# 'stats', -# 'status', - 'stop', - 'swap "1" "2"', - 'swapid "%(id)s" "%(id2)s"', -# 'tagtypes', -# 'update', -# 'urlhandlers', -# 'volume', + 'add "%(url)s"', + 'addid "%(url)s" "1"', + 'clear', + #'clearerror', + #'close', + #'commands', + 'consume "1"', + 'consume "0"', + # 'count', + 'crossfade "1"', + 'crossfade "0"', + #'currentsong', + #'delete "1:2"', + 'delete "0"', + 'deleteid "%(id)s"', + 'disableoutput "0"', + 'enableoutput "0"', + #'find', + #'findadd "artist" "%(artist)s"', + #'idle', + #'kill', + #'list', + #'listall', + #'listallinfo', + #'listplaylist', + #'listplaylistinfo', + #'listplaylists', + #'lsinfo', + 'move "0:1" "2"', + 'move "0" "1"', + 'moveid "%(id)s" "1"', + 'next', + #'notcommands', + #'outputs', + #'password', + 'pause', + #'ping', + 'play', + 'playid "%(id)s"', + #'playlist', + 'playlistadd "foo" "%(url)s"', + 'playlistclear "foo"', + 'playlistadd "foo" "%(url)s"', + 'playlistdelete "foo" "0"', + #'playlistfind', + #'playlistid', + #'playlistinfo', + 'playlistadd "foo" "%(url)s"', + 'playlistadd "foo" "%(url)s"', + 'playlistmove "foo" "0" "1"', + #'playlistsearch', + #'plchanges', + #'plchangesposid', + 'previous', + 'random "1"', + 'random "0"', + 'rm "bar"', + 'rename "foo" "bar"', + 'repeat "0"', + 'rm "bar"', + 'save "bar"', + 'load "bar"', + #'search', + 'seek "1" "10"', + 'seekid "%(id)s" "10"', + #'setvol "10"', + 'shuffle', + 'shuffle "0:1"', + 'single "1"', + 'single "0"', + #'stats', + #'status', + 'stop', + 'swap "1" "2"', + 'swapid "%(id)s" "%(id2)s"', + #'tagtypes', + #'update', + #'urlhandlers', + #'volume', ] @@ -116,8 +116,8 @@ def create_socketfile(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) sock.settimeout(0.5) - fd = sock.makefile('rw', 1) # 1 = line buffered - fd.readline() # Read banner + fd = sock.makefile('rw', 1) # 1 = line buffered + fd.readline() # Read banner return fd