Kitten Reward add on not working Version ⁨2.1.49 (dc80804a)⁩

Any help is much appreciated

Could you put a link to the add-on here? I can’t find it in AnkiWeb. Also, posting the error message (if any) here can help.

Here is what I have on file:

-- coding: utf-8 --

Copyright: (C) 2018 Lovac42

Support: GitHub - lovac42/KittenRewards: Anki Addon: adds a cute kitten on congrats screen after deck is finished

License: GNU GPL, version 3 or later; The GNU General Public License v3.0 - GNU Project - Free Software Foundation

Version: 0.0.2

from aqt import mw
from anki.hooks import wrap
import aqt.mediasrv
import anki.sched, anki.schedv2
from anki.utils import isMac, isLin
import random, os, re

from aqt.utils import showWarning, showText

IMG_EXT = re.compile(r’.(?:jpe?g|gif|png|tiff|bmp)$’, re.I) #Perl FTW! <3

RES_DIR = ‘kitten_rewards’
CATS_DIR = os.path.abspath(os.path.join(os.path.dirname(file), RES_DIR))
CATS_IMGS = [i for i in os.listdir(CATS_DIR) if IMG_EXT.search(i)]

def finishedMsg(self, _old):
image_path = RES_DIR+’/’+random.choice(CATS_IMGS)
msg="""
Congratulations! You have finished this deck for now.



%s
“”"%(image_path,self.nextDueMsg())
return (
(msg))

anki.sched.Scheduler.finishedMsg = wrap(anki.sched.Scheduler.finishedMsg, finishedMsg, ‘around’)
anki.schedv2.Scheduler.finishedMsg = wrap(anki.schedv2.Scheduler.finishedMsg, finishedMsg, ‘around’)

Replace /user/collection.media folder with actual addon path

def _redirectWebExports(path, _old):
if path.startswith(RES_DIR):
return CATS_DIR, path[len(RES_DIR) + 1:]
return _old(path)

aqt.mediasrv._redirectWebExports = wrap(aqt.mediasrv._redirectWebExports, _redirectWebExports, ‘around’)

It seems the author is aware of the add-on not working on recent Anki versions, but he hasn’t updated it yet. He also removed it from AnkiWeb. I think it was here: https://ankiweb.net/shared/info/1627107763