diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -3,6 +3,7 @@ import argparse import sys import os +from pprint import pprint try: from termcolor import cprint @@ -10,7 +11,7 @@ try: except ImportError: colors_supported = False -from data_lib import load_data, decode_auto +from data_lib import load_data, decode_auto, clean_string def print_colored(s, color, fallback_prefix=''): @@ -32,8 +33,8 @@ def main(): parser.add_argument('--reverse-decoded', action='store_true') args = parser.parse_args() - data = load_data() - + data = load_data('date', sort_reverse=True) + if args.decode: # filter by type if args.type == 2: @@ -41,9 +42,6 @@ def main(): else: data = list(filter(lambda i: 'type' not in i, data)) - # sort by text length - data = sorted(data, key=lambda i: len(i['text'])) - for obj in data: text = obj['text'] text_decoded = decode_auto(text, @@ -53,7 +51,7 @@ def main(): # print all information print(obj['text']) - print_colored(text, 'green', fallback_prefix='[CLEANED] ') + print_colored(clean_string(text, remove_junk=(not args.with_junk)), 'green', fallback_prefix='[CLEANED] ') print_colored(text_decoded, 'cyan', fallback_prefix='[DECODED] ') if 'pic' in obj: |