b1337xyz / fzfanime

A Command Line Interface to browse and watch anime locally.
11 stars 0 forks source link

How to force populate json file and a question about accessing bash functions inside fzf #1

Closed sweetbbak closed 1 year ago

sweetbbak commented 1 year ago

Sorry to bother you for something small but I'm having an issue with populating the json. -u|--update just prints "Nothing new" is there something I'm missing?

Also I've been breaking down and trying to understand how this script works for 5 hours or so and I'm not making any progress. I was trying to achieve something similar to this with Novelupdates and asurascans for manga.

I wrote a few scrapers in python that gave me json files with novel information and a cover image. It was fairly easy to display all of that in fzf with an image while kitty and icat worked with fzf but that is broken now. One of the big issues I ran into was being able to access functions from within fzf. This was the solution that I came up with https://github.com/sweetbbak/manga-sh/blob/main/asura.sh which isnt really elegant at all.

Im curious how you are calling functions within fzf and what is the basic loop that is going on here? That would be a huge help to me since I'm making a few things that are very similar. Thank you

b1337xyz commented 1 year ago

You have to edit the config file first, tools/utils.py will read that file... i should add more info on that, sorry.
tools/update.py will search for the sub folders (titles) in the directories provided in the config file and fetch all the information using jikan and anilist APIs.

Im curious how you are calling functions within fzf and what is the basic loop that is going on here?

exporting the functions should work, the same for variables with declare -x.
There's no "loop".. fzf will keep running and the input list is updated through key bindings reload(...).

sweetbbak commented 1 year ago

Ahh okay, I was misunderstanding a little bit. I didnt even think about using declare to be able to make functions and variavles available to fzf. Thank you for the help.