Page 1 of 1

Trying to run AnkiConnect with Rainmeter

Posted: February 13th, 2020, 4:41 pm
by imaquietkid
I am trying to make a skin that would connect with Anki and display how many cards are due at a given moment. Maybe even (if I can) have a way to add cards directly from the desktop. From what I understand it should be possible with AnkiConnect (website here). The AnkiConnect website gives some example code in Python and JavaScript, so I guess my job is to translate that into lua but I'm kinda out of my depths here.

There are these two lines of Python code that I just straight up don't understand :

Code: Select all

    requestJson = json.dumps(request(action, **params)).encode('utf-8')
    response = json.load(urllib.request.urlopen(urllib.request.Request('http://localhost:8765', requestJson)))
I also think I need to import a JSON module to be able to use the API, and I'm not sure how to do that with Rainmeter.

Any help would be massively appreciated, thanks in advance.

Re: Trying to run AnkiConnect with Rainmeter

Posted: February 13th, 2020, 5:07 pm
by LGP123
I don't think there are ways to use APIs directly in Rainmeter without using external program, but you could for example add in your @Resource folder a small python program ran by rainmeter that could call Anki's API (for compatibility purpose, you should also include a python instance in the skin files).

Re: Trying to run AnkiConnect with Rainmeter

Posted: February 13th, 2020, 5:33 pm
by imaquietkid
I see, fair enough, I didn't even think of using Python directly, but I can manage that. Thank you!