Closed MrE3gman closed 5 years ago
Hi @MrE3gman.
I think the problem comes from https://github.com/Azelphur/PokemonGo-CalcyIV-Renamer/blob/039103de533501be9605c2151412c6378e6010ef/pokemonlib.py#L46 where it should be (exec-out
instead of shell
):
_, stdout, _ = self.__adb(["adb", "-s", self.device_id, "exec-out", "screencap", "-p"])
You should try and tell us if it solves the problem.
I'm also working on a fork of the project here: https://github.com/marob/PokemonGo-CalcyIV-Renamer/tree/v2 that should solve this problem (as well as add new features I'm currently working on).
Regards
could you please paste me the line as i should write it
PS: your branch gives me errors finding configparser
Sorry if I was not clear. You should either keep the code of this project (not my fork) and replace the line https://github.com/Azelphur/PokemonGo-CalcyIV-Renamer/blob/039103de533501be9605c2151412c6378e6010ef/pokemonlib.py#L46 with:
_, stdout, _ = self.__adb(["adb", "-s", self.device_id, "exec-out", "screencap", "-p"])
or try to use my fork that fixes this issue. But you will indeed need other dependencies for my fork (pip install configparser
and maybe others but I haven't documented it yet)
After installing the modules i didn't have from your branch it gave me the same cannot identify image file error
Can you try to run the following code (save it in a file or just copy/paste it in python REPL)?
import time
import subprocess
from PIL import Image
from io import BytesIO
args = ["adb", "exec-out", "screencap", "-p"]
p = subprocess.Popen([str(arg) for arg in args], stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
image = Image.open(BytesIO(stdout))
image.save('{}.png'.format(time.time()))
It should create a png file in the current directory. And that file should be a valid image (try to open it with any image viewer).
@marob thanks for the suggestion on line 46, It's a good one and I've made the change.
@MrE3gman can you download the latest version and see if it works for you now?
@Azelphur I get the exact same error, it changes the code of the object depending on where the calcy button is exactly but the error is the same
@MrE3gman oops, I messed up the commit with the fix, can you update again and try the latest version?
@Azelphur The error has been resolved, but now I'm facing a bunch of other problems that I think are caused due to the diference in the UI on an 18/9 device. I have to position the calcy button lower to make it actually work wich is why i think that might be the problem.
The issues are as following:
The renaming tap does not open the renaming dialog (prob is tapping lower than where it should)
On the Redmi 5 Plus I have gestures enabled so when it swipes it actually detects it as a back, I would suggest changing the swipe to get to the next pokemon for a tap under the fav icon on the top right of the screen.
That's gonna be interesting to solve. Can you send a screenshot of your phone with the calcy IV dialog open? I'll investigate.
Here are a couple of screenshots of how calcy looks, first ones from the Redmi 5 Plus and the third one is from the OPO 5T. I added one without calcy open so you can see all the UI (Redmi 5 Plus). All screenshots are taken on 0.103.3. Calcy config is he exact same one on booth phones, was imported for theese screenshots.
Thanks, you are correct it is an aspect ratio thing. Not sure how I'm going to solve it yet. Will need to give it some thought.
Tapping below the favourite icon is pretty cool - didn't know that was a thing. Will definitely be making that change once I figure out how best to support different aspect ratios.
If you need any help on trying updated versions definetly reach me, I'd be glad to help.
@Azelphur on my fork, I'm adding auto-detection based on image analysis to be resolution and ratio free. It's still in progress, but I think it's a good approach.
For example, I'm already detecting the Y coordinate of the pokemon name / rename button by image analysis. I'm also finding the CalcyIV coordinates by image analysis (to make it simpler, as I've no idea where the button can be on the screen and whether it has transparency or not, I'm going on the rename screen that has a green background to make it easier to spot).
N.B.: I wasn't aware of the "tapping under the favorite" feature either! That's cool and I think I'll use it. I've also recently discovered that there is no need to spot the exact location of the rename button as you can click on the name of the pokemon (so you only need the Y coordinate and use width/2 as X coordinate)
Why close? It's still a bug that needs fixing :)
@marob It does sound very good, I eagerly await your pull request :)
@MrE3gman I've done an ugly hack that should make things work on your 18:9 phone, until I come up with a better idea. Can you download the aspect-ratio-hack branch and let me know if it works for you?
Seems to work better, but the script enters on a loop detecting if calcy has oppened when it checks pixel 49x129 it does not get the expected value even tho calcy is open. Also after a number of errors it seems that the script is designed to swipe to the next pokemon, triggering my gesture detection making a back and landing me on the pokemons list
@Azelphur you can fix that by tapping the far left and far right of a pokemon to switch between them instead
I've just done some of this, mainly: Calcy IV communication is now done with intents, so it doesn't matter where the Calcy IV button is Advancing to next pokemon is now done with taps instead of swipes
Still work to be done, though.
Hi @Azelphur. I'm really interested by your intent approach. How did you find the ACTION_ANALYZE_SCREEN and ACTION_HIDE_BUTTON intents? Is there a way to list them?
By the way, I previously suggested some improvements in a branch on my fork, but it lead to huge modifications... that lead to re-writing everything in Node (electron): https://github.com/marob/pokemon-go-toolbox It's a work in progress, but some of my new approaches may interest you:
Those are some really interesting features, cool stuff. Those intents are actually documented: https://www.reddit.com/r/CalcyIV/wiki/features
You can also get at a list of intents by running dumpsys package tesmath.calcy
What log file are you tailing to get at that info?
Actually just found it, it spits it out on logcat, that's really useful to know. :)
Nice! I actually didn't think they were documented.
Have you managed to resolve aspect ratios? I haven't figured out a good way to do that, as of yet.
I'm currently not trying to rename pokemons (at first), just scan them and display them in the UI (on desktop), so I don't have any needs for zone detection.
But you can find some unused code that does pixel detection (that should't be affected by aspect ratio) in my project.
You can also find usage of dumpsys window windows
for CalcyIV overlay detection (that will probably soon be replaced by Intents!).
@MrE3gman with the latest patch, the script no longer uses screenshots to detect Calcy IV success, and now uses logcat. This should be the last piece in the puzzle to get things working on your phone.
Try running the script with --name_line_y=42.59 - you may also need to specify --ok_button_y and --save_button_y
Let me know if you're able to get it working :)
I've actually tried to run the script and now i get this error, and also the calcy iv button disapears on my phone, it seems to bugg out the app
2018-07-22 22:54:46,417 - PokemonGo - DEBUG - Return code 0
Traceback (most recent call last):
File "ivcheck.py", line 63, in
This should all be solved in the rewrite, you'll need to edit config.yaml to set the appropriate x,y locations for your 16:10 phones. :)
Can you give it another try and report back if it works for you?
Closing due to inactivity.
Im having issues running the script, i have python 2.7 and instaled the python-pillow aswell, after getting my phone on adb I get this.
I'm not very literate in coding, so I'm not really sure whats going on, i have two 18:9 phones (Redmi 5 Plus and OPO 5T). Thanks in advance