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

Offline Mode #9

Open
UltraBlackLinux opened this issue Oct 29, 2022 · 5 comments
Open

Offline Mode #9

UltraBlackLinux opened this issue Oct 29, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@UltraBlackLinux
Copy link

Hey there,
I would love to use this, but it's downloading all the sprites on-demand. I'm using a cellular connection, thus this is not something I can use.
Please add an offline mode!
Thanks!

@acxz
Copy link
Owner

acxz commented Feb 23, 2023

This is a great idea and we would definitely like to add it to the codebase as a new feature.
Thanks for the suggestion, @UltraBlackLinux!

@acxz acxz added the enhancement New feature or request label Feb 23, 2023
@acxz
Copy link
Owner

acxz commented Nov 10, 2024

From another issue:

For downloading the full dataset I can add some scripts that when run will download all the files associated with that option. For example ./download-small-sprites.sh, ./download-big-sprites.sh, ./download-animated-sprites.sh.

Had some more thoughts on this, having an option to download only certain ranges of pokemon might be worth it, i.e. by gen or region or a custom list.

@pr3c0g
Copy link

pr3c0g commented Nov 21, 2024

I'd love to collaborate on this, is this currently being developed by someone?

@acxz
Copy link
Owner

acxz commented Nov 21, 2024

@pr3c0g I really really appreciate that offer. I'm not currently working on this, so I would love if you want to take this issue up.

Part I:

Here is really the outline on going about solving this issue:
Piggyback off the pokeshell command itself and simply introduce a flag that will only download files and not display them.

i.e. Introduce the --download/--no-display/-d option.
e.g. pokeshell --small --download ns:pikachu+♂ will download the small image in ~/.cache/pokeshell but not display it

This itself is a nice and small atomic PR, you can see the -n/--show-name flag is done for this. At some point I need to use getopt, instead of the weird jank flag parsing I'm doing right now...

Part II:

That is nice and simple, but what if someone just specifies pikachu.
e.g. pokeshell --download pikachu
We would want this to download s:pikachu+♂, ns:pikachu+♂, s:pikachu+♀, ns:pikachu+♀. (forget about forms for now, tbh forms needs a reworking at the pokeapi level)
So basically if the flag is --download/--no-display/-d, everywhere in the code path there is a decision on the specific image to display, we simple add all the options to the list of pokemon images to download.

So something like pokeshell -a -d random would download every pokemon (shiny/not shiny) (male/female/genderless) and something like pokeshell -a -d random,1,2 would essentially expand out to every pokemon (shiny/not-shiny) (male/female/genderless) from gen 1 and gen 2. Maybe something like random would be a misnomer and instead the keyword all should be introduced, i.e. pokeshell -a -d all,1,2 and something like pokeshell -a -d all:pikachu+all would expand out to pokeshell -a -d ns:pikachu+m ns:pikachu+f s:pikachu+m ns:pikachu+f. The all keyword would be useful so that you can actually display these if you want instead of piggybacking off of random in the --download mode so to speak. So pokeshell all,1 would end up displaying all gen 1 pokemon. Better be fast on the Ctrl-C.

So based on the above thoughts the next atmoic PR would be to introduce the all keyword in the pokeshell pokemon specification and the corresponding logic to expand the list of specified pokemon where all is used, right now it is at the shiny/not shiny, male/female, and pokemon level. (Don't worry about forms, it is a can of worms unfortunately) I mean you can still do all:deerling-spring+all and that will work, but all:deerling+all will fail to get all the forms of deerling and that's because deerling itself fails to query all the forms of Deerling to pick one to display. My initial thoughts for this tho, would be to have the spec: all:deerling-all+all to get all forms of deerling, all shiny/not shiny, and all genders. This fails if there is a pokemon/form called deerling-all tho... Anyway don't want to put too much thought into random or all forms right now.

What happens when the input is pokeshell all:pikachu+all all:pikachu+all? How to look ahead in the input and check for redundancy? hmm a bit more complicated from what it seems at a first glance...
But tbh we just do it naively, i.e. pokeshell all:pikachu+all all:pikachu+all simply expands to pokeshell ns:pikachu+m s:pikachu+m ns:pikachu+f s:pikachu+f ns:pikachu+m s:pikachu+m ns:pikachu+f s:pikachu+f i.e. just that many more pikachu's to display

Part III

This is where a little bit more logic comes into play and to be honest it is also something that starts extending pokeshell. i.e. let's say you have a text file call fire-starters.pkshl written like so:

fire-starters.pkshl:

ns:charmander
cyndaquil+♂
s:アチャモ+♂

and we have pokeshell read from a file like so pokeshell -s fire-starters.pkshl, neat right?
and of course pokeshell -s -d fire-starters.pkshl would download the specified pokemon (in this case male and female charmander, shiny/not-shiny cyndaquil, and shiny male torchic.

This might be something that we want to include in the script itself or have helper scripts for. Or say we just write a write a download-pokeshell-images.sh script which simply calls pokeshell with the --no-display flag and a list of pokemon. Like so:

download-pokeshell-images.sh

#!/usr/bin/env bash

pokeshell -s -d all:pikachu+all
pokeshell -b -d all:pikachu+all
pokeshell -a -d all:pikachu+all

This downloads all pikachu not shiny/shiny male/female small, big, and animated sprites.

Or even:

#!/usr/bin/env bash

pokeshell -d all:bulbasaur+all all:ivysaur+all # and so on

Or

#!/usr/bin/env bash

pokemon_to_download=(
all:ナエトル:all
all:hayashigame:all
all:torterra:all
)

pokeshell -n -d pokemon_to_download

TBH since this is bash, folks should be easily able to pipe a file in to pokeshell so maybe this is really no support required and just some info on the README under usage.

So this PR would simply be a documentation PR showing folks how to pipe files into pokeshell.

Side comment:
If we are using files, we can actually create a grammer (ala tree-sitter) that can actually syntax check and do things like syntax highlighting and autocompletions etc. of these .pkshl files. And to be honest that is what the tab completions do anyway. Similar to https://pokepast.es/ (in our case we'll be more focused on the options for visual differences rather than competitive differences (i.e. abilities, stats, etc.). There is the thought that should we use the same spec for describing pokemon... I'll have to compare and see, but tbh I like the spec that I made here, it is quite powerful imo.

🍪 for reading all my thoughts. This was p much a brain dump, but it was a good brainstorming session ig.

The 3 PRs mentioned:

  1. --no-display/--download/-d flag
  2. all keyword
  3. documentation on how to pipe files to pokeshell

can be done in any order, but 1 and 2 close this PR and 3 is user support.

@acxz
Copy link
Owner

acxz commented Nov 24, 2024

Update on Part II (add the all specification): Added all to shinys and genders.
Still need to add all to pokemon.

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

No branches or pull requests

3 participants