Wintermute0110 / torrentverify

List torrent file contents and checks downloaded data
38 stars 5 forks source link

option to remove ANSI codes from output? #4

Open rickremer opened 5 years ago

rickremer commented 5 years ago

Windows 10 x64, python 3.7.3, running under a venv

The output appears to contain ANSI escape sequences, but apparently this is not well-supported on Windows. (I "weakly" tried pip-installing colorama but it didn't seem to take.) I could of course simply remove the sequences, but there is probably a more elegant solution.

Wintermute0110 commented 5 years ago

Can you please put an example of the console output, so I can get an idea of what needs to be done?

rickremer commented 5 years ago

Capture

Wintermute0110 commented 5 years ago

OK, I understand now. You want an option like '--nocolours'. It will take a bit, summer I will be very busy with RL.

rickremer commented 5 years ago

It seems either curses or colorama is "the way to go" for cross-platform colored output. https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python

No rush, maybe I'll try my hand at working it in.

rickremer commented 5 years ago

wow, that was easier than I thought...

  1. pip install colorama (of course)
  2. Insert after the IMPORTs: image

... and it "just works": image

If I'm understanding the documentation correctly, on systems that properly support ANSI codes, colorama is basically just ignored; it only steps in for the windows console.

Wintermute0110 commented 5 years ago

Cool! I will incorporate your patch to the code ASAP.

Also, torrentverify needs a code update and cleaning. On years since I coded it I have learnt much more Python and now some parts of the code, although working, look embarrassing :)