Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

add a new action: getMediaDirPath #379

Merged
merged 2 commits into from
Mar 23, 2023
Merged

add a new action: getMediaDirPath #379

merged 2 commits into from
Mar 23, 2023

Conversation

tatsumoto-ren
Copy link
Contributor

This PR adds the getMediaDirPath action that returns the full path to the user's collection folder.

Currently Mpvacious has to rely on the storeMediaFile action to add new audio and images to the collection, but this proves to be problematic. When called with base64-encoded data, it may fail if the file is too big, and when called with a path to a temporary file, it may fail because Anki doesn't have access to the folder where the file is stored.

With this function we would be able to send files directly to the collection.media folder without encoding them as base64 or using temporary files.

@FooSoft
Copy link
Owner

FooSoft commented Mar 23, 2023

Looks good, could you just add a simple test case for calling this API and making sure it doesn't fail?

@tatsumoto-ren
Copy link
Contributor Author

I can try. This repo doesn't include any docs on how to create and run tests, I'll try inferring that from the source code.

Seems like I need a program called tox, never heard of it.

@FooSoft
Copy link
Owner

FooSoft commented Mar 23, 2023

Thanks!

@FooSoft FooSoft merged commit bf5c73b into FooSoft:master Mar 23, 2023
@tatsumoto-ren
Copy link
Contributor Author

The extension on AnkiWeb hasn't been updated yet. It would be awesome if you uploaded a new version 🙏.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants