def display_properties(options): """ Display properties """ properties = api.properties(options) if options.get('json'): if options.get('values'): print(json.dumps(properties, cls=GuessitEncoder, ensure_ascii=False)) else: print(json.dumps(list(properties.keys()), cls=GuessitEncoder, ensure_ascii=False)) elif options.get('yaml'): import yaml from guessit import yamlutils if options.get('values'): print(yaml.dump(properties, Dumper=yamlutils.CustomDumper, default_flow_style=False, allow_unicode=True)) else: print(yaml.dump(list(properties.keys()), Dumper=yamlutils.CustomDumper, default_flow_style=False, allow_unicode=True)) else: print('GuessIt properties:') properties_list = list(sorted(properties.keys())) for property_name in properties_list: property_values = properties.get(property_name) print(2 * ' ' + '[+] %s' % (property_name,)) if property_values and options.get('values'): for property_value in property_values: print(4 * ' ' + '[!] %s' % (property_value,))