list connected server obj.
continue when connections fail when comparing multiple servers. search main server once.
This commit is contained in:
parent
c0b4cebd4a
commit
5cf5c7d1ba
@ -53,7 +53,7 @@ SERVER_DICT = {server.name: server for server in
|
||||
if 'server' in server.provides.split(',')}
|
||||
|
||||
shared_lst = []
|
||||
|
||||
server_lst = []
|
||||
|
||||
def find_things(server):
|
||||
dict_tt = {'movie': [], 'show': []}
|
||||
@ -131,19 +131,26 @@ if __name__ == "__main__":
|
||||
server_connected = other_server.connect()
|
||||
print('Connected to {} server.'.format(
|
||||
server_connected.friendlyName))
|
||||
server_lst.append(server_connected)
|
||||
except Exception as e:
|
||||
sys.stderr.write("Error: {}".format(e))
|
||||
sys.stderr.write("Error: {}.\nSkipping...\n".format(e))
|
||||
pass
|
||||
|
||||
if len(server_lst) == 0:
|
||||
sys.stderr.write("Need more than one server to compare.\n")
|
||||
sys.exit(1)
|
||||
|
||||
main_section_dict = find_things(main_server)
|
||||
their_section_dict = find_things(server_connected)
|
||||
|
||||
for connection in server_lst:
|
||||
their_section_dict = find_things(connection)
|
||||
print('Comparing findings from {} and {}'.format(
|
||||
main_server.friendlyName, server_connected.friendlyName))
|
||||
main_server.friendlyName, connection.friendlyName))
|
||||
main_dict = diff_things(main_section_dict, their_section_dict)
|
||||
# pop main keys
|
||||
main_dict.pop('movie', None)
|
||||
main_dict.pop('show', None)
|
||||
filename = 'diff_{}_{}_servers.json'.format(opts.server[0], server)
|
||||
filename = 'diff_{}_{}_servers.json'.format(opts.server[0], connection)
|
||||
|
||||
with open(filename, 'w') as fp:
|
||||
json.dump(main_dict, fp, indent=4, sort_keys=True)
|
||||
|
Loading…
Reference in New Issue
Block a user