Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log in Color #2675

Closed
DimaVIII opened this issue Aug 7, 2016 · 27 comments
Closed

Log in Color #2675

DimaVIII opened this issue Aug 7, 2016 · 27 comments

Comments

@DimaVIII
Copy link

DimaVIII commented Aug 7, 2016

How to activate the log in color as it was before the api update?

@ColdSunERA
Copy link

The colors have been stripped. There is no easy toggle at the moment.

@celus
Copy link

celus commented Aug 7, 2016

Why was the color removed in the first place?

@DimaVIII
Copy link
Author

DimaVIII commented Aug 7, 2016

It's somewhere in https://github.com/keyphact/pgoapi right?

@ColdSunERA
Copy link

No. It isn't in the pgoapi, and there is no easy way to turn it in.

@Baconnaise
Copy link

They stripped the color before the change if I recall then the API changed. It's sort of a mess right now compared to before. I don't know if they plan to move this info to the map or not. The old map you could just drop clones of folders with different configs for different bots and open each index to see where they were at. They changed that as well so I haven't bothered to look again.

I do miss that color coding as I run multiple monitors so if I'm walking by or happen to be at the desk I know exactly what's going and if things are running correctly. I'll have to look and see if the map is any good like before.

@iruy
Copy link

iruy commented Aug 7, 2016

It is such a mess right now without colors... Please somebody bring them back

@tvb
Copy link

tvb commented Aug 7, 2016

+1 I favor the colors as well! Much easier to read back

@nikmess
Copy link

nikmess commented Aug 7, 2016

Quick and dirty fix:
Save this as colorizer.sh in the PokemonGo-Bot directory:

#!/bin/bash

red=$(tput bold;tput setaf 1)            
green=$(tput setaf 2)                    
yellow=$(tput bold;tput setaf 3)         
fawn=$(tput setaf 3)
blue=$(tput bold;tput setaf 4)           
purple=$(tput setaf 5)
pink=$(tput bold;tput setaf 5)           
cyan=$(tput bold;tput setaf 6)           
gray=$(tput setaf 7)                     
white=$(tput bold;tput setaf 7)          
normal=$(tput sgr0)                      

sep=`echo -e '\001'` # use \001 as a separator instead of '/'

while [ -n "$1" ] ; do
  color=${!1}
  pattern="$2"
  shift 2

  rules="$rules;s$sep\($pattern\)$sep$color\1$normal${sep}g"
done

#stdbuf -o0 -i0 sed -u -e "$rules"
sed -u -e "$rules"

(from https://stackoverflow.com/questions/241325/color-regex-matches-without-dropping-misses)

Then run something like this:
python pokecli.py 2>&1 | ./colorizer.sh red ".*PokemonCatchWorker.*" blue ".*TransferPokemon.*" green ".*IncubateEggs.*" yellow ".*SpinFort.*" pink ".*CollectLevelUpReward.*"

@Kyokoo
Copy link

Kyokoo commented Aug 7, 2016

Then run something like this:
python pokecli.py 2>&1 | ./colorizer.sh red ".PokemonCatchWorker." blue ".TransferPokemon." green ".IncubateEggs." yellow ".SpinFort." pink ".CollectLevelUpReward."

If you're using Mac you may need to install gnu-sed using brew.
Then you must change sed -u -e "$rules" to gsed -u -e "$rules"

@crvfts
Copy link
Contributor

crvfts commented Aug 7, 2016

anyone know how to do this in windows?
python pokecli.py 2>&1 | ./colorizer.sh red ".*PokemonCatchWorker.*" blue ".*TransferPokemon.*" green ".*IncubateEggs.*" yellow ".*SpinFort.*" pink ".*CollectLevelUpReward.*"
end up giving an error

@nikmess
Copy link

nikmess commented Aug 7, 2016

That script works only on *nix systems. You might want to have a look at Cygwin, which gives you a unix style terminal under Windows.
edit: or if you used Git for Windows to clone this repo, you can just as well use the MINGW64 shell that comes with it - which is what I'm doing.

@crvfts
Copy link
Contributor

crvfts commented Aug 7, 2016

@nikmess works perfectly with Git for Windows! I was previously attempting to run the line from Windows command line.

Thank you for your help!

@Kyokoo
Copy link

Kyokoo commented Aug 7, 2016

@nikmess Using your script I donc have any stats when session end :/

@nikmess
Copy link

nikmess commented Aug 7, 2016

It seems the problem is not (only?) my script, but rather the mingw shell. Killing "python pokecli.py" with ^c gives no stats either in mingw.

@serberus7
Copy link

Or you can just use my cell workers.
I added colors and they are working fine.

cell_workers.zip

@4x3lpri3t0
Copy link

@serberus7 not working for Windows 10 unfortunately.

@serberus7
Copy link

Lol @Zedronar then what is this?
lol

@4x3lpri3t0
Copy link

@serberus7 Must be something wrong with my configuration then.

@Sayujya
Copy link

Sayujya commented Aug 7, 2016

For anyone on OSX, go to the directory, and type

source bin/activate 
brew install gsed
sudo vim colorizer.sh

then inside vim copy paste this version of @nikmess 's script

#!/bin/bash

red=$(tput bold;tput setaf 1)            
green=$(tput setaf 2)                    
yellow=$(tput bold;tput setaf 3)         
fawn=$(tput setaf 3)
blue=$(tput bold;tput setaf 4)           
purple=$(tput setaf 5)
pink=$(tput bold;tput setaf 5)           
cyan=$(tput bold;tput setaf 6)           
gray=$(tput setaf 7)                     
white=$(tput bold;tput setaf 7)          
normal=$(tput sgr0)                      

sep=`echo -e '\001'` # use \001 as a separator instead of '/'

while [ -n "$1" ] ; do
  color=${!1}
  pattern="$2"
  shift 2

  rules="$rules;s$sep\($pattern\)$sep$color\1$normal${sep}g"
done

#stdbuf -o0 -i0 gsed -u -e "$rules"
gsed -u -e "$rules"

type :wq to save and quit the file

then type
sudo chmod 777 colorizer.sh

After that you can use @nikmess 's script again
python pokecli.py 2>&1 | ./colorizer.sh red ".*PokemonCatchWorker.*" blue ".*TransferPokemon.*" green ".*IncubateEggs.*" yellow ".*SpinFort.*" pink ".*CollectLevelUpReward.*"

@Baconnaise
Copy link

@serberus7 Works great. Thank you.

Win7x64.

@Vvkmnn
Copy link

Vvkmnn commented Aug 7, 2016

@serberus7 @Baconnaise Where are you putting that zip file?

I made a directory called resources in the parent and directory and the sub directory, but the script won't seem to notice, despite being on commit fc4e802, which should have .zip support.

@relomy
Copy link

relomy commented Aug 7, 2016

It's just his cell_workers folder.

On Sun, Aug 7, 2016 at 3:36 PM, Vivek Menon notifications@github.com
wrote:

@serberus7 https://github.com/serberus7 Where are you putting that zip
file?

I made a directory called resources in the parent and directory and the
sub directory, but the script won't seem to notice, despite being on commit
fc4e802
fc4e802,
which should have .zip support.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2675 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGGmHG01CNPzCz0f9f0h8OpjkkHj8YeGks5qdjPBgaJpZM4JecDN
.

@Vvkmnn
Copy link

Vvkmnn commented Aug 7, 2016

Ah. I thought we could just leave plugins in the directory now, as per #2766.

I'll just extract into ./pokemongo_bot/cell_workers/

@Baconnaise
Copy link

@Vvkmnn That would actually be great if we had various color and formatting plugins.

@SingularityIO
Copy link

SingularityIO commented Aug 7, 2016

For the people too dumb to comprehend what it is Serberus has done, he's modified the generic py files that output using formatted print (aka the text you see) to include colours, he's uploaded the Files so it's easier for people to just drag and drop...

That being said ive Updated the version of @serberus7 colours as of the live change 30+ Mins ago (which changes some of the files)

http://puu.sh/qtlX7/570de9c1a3.zip

@hklcf
Copy link
Contributor

hklcf commented Aug 8, 2016

#2809

@douglascamata
Copy link
Member

This is not a bug, it's an intended behaviour. Colourful log might come back in future updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests