print('Encoding-mode is set to HUFFMAN.') from huffman import Huffman coder = Huffman() # Choose built-in omega or generate own? if (args['dictionary'] == 'b'): if (args['verbose']): print('Using build-in dictionary!') coder.buildOwn = False else: if (args['verbose']): print('We need to generate / use our own dictionary!') if (args['uncompression'] != None): try: f = open('./'+args['source']+'.huff', 'rb') coder.setOmega(pickle.load(f)) except Exception: print('Unable to read huffman-dictionary!') print('Please recover it with filename: '+args['source']+'.huff') quit() # RUN-LENGHT-ENCODING elif (args['compression'] == 'r' or args['uncompression'] == 'r'): if (args['verbose']): print('Encoding-mode is set to RLE.') from rle import RunLenghtEncoding coder = RunLenghtEncoding() else: print('ERROR') quit()