-
Notifications
You must be signed in to change notification settings - Fork 218
"storeMediaFile" returning error for syncDelete #146
Comments
The updated function is here I think:
https://github.com/ankitects/anki/blob/master/pylib/anki/media.py#L117 The change appears after version 2.1.21 in version 2.1.22 with the removal of Unfortunately the new function only appears in 2.1.22. Method signature has also changed from It also appears the functionality of I would be concerned by these changes overall as its not super clear where we should be hooking into at all and will probably need to have more then one implementation for different versions. It appears a 'hooks' repository has appeared that maps out supported addOn functionality |
Following code does seem to work. I'm still testing backward compatibility though def some_function(filename):
try:
self.media().syncDelete(filename)
except AttributeError:
self.media().trash_files([filename]) |
This is the new docs do anki addons on which hooks we should be using I think. Pretty sparse for a lot of the functionality really https://github.com/ankitects/addon-docs/blob/master/hooks-and-filters.md |
@c-okelly that looks like it should work -- if you could open a PR with that change after verification, I would appreciate it :) |
Ran into this error with Yomichan's screenshot feature also. Confirming that @c-okelly's solution seemed to work. |
In reference to issue FooSoft#146 Also added the `deleteMediaFile` when dealing with urls. The new functionality of `writeData` means that is there is a name conflict it will rename the file. This way the behavior of your api does not change. Only potential issues I see with this is that the file is `trashed` but not deleted. So is only cleared up on the usual clear up. Test locally using my own Anki install at `2.1.22` and POST man to create new media
Just opened there. Only issue I really see is that the files are trashed rather then deleted. It seems some parts of this project might have migrated to Rust |
AnkiConnect with this change has now been pushed to AnkiWeb, thanks all 👍 |
When I try to use storeMediaFile I am consistently getting the following error as of recent:
Error: 'MediaManager' object has no attribute 'syncDelete'
Looking at Anki's code, it does not look like media.py has syncDelete as of recent versions:
https://github.com/ankitects/anki/blob/cc44523449cda621c20f80e6583040deb57debb1/pylib/anki/media.py
The text was updated successfully, but these errors were encountered: