diff --git a/README.md b/README.md index 6ad756b..a9d139e 100644 --- a/README.md +++ b/README.md @@ -1759,6 +1759,32 @@ corresponding to when the API was available for use. ``` +#### `getMediaDirPath` + +* Gets the full path to the `collection.media` folder of the currently opened profile. + +
+ Sample request: + + ```json + { + "action": "getMediaDirPath", + "version": 6 + } + ``` +
+ +
+ Sample result: + + ```json + { + "result": "/home/user/.local/share/Anki2/Main/collection.media", + "error": null + } + ``` +
+ #### `deleteMediaFile` * Deletes the specified file inside the media folder. diff --git a/plugin/__init__.py b/plugin/__init__.py index e9c7b75..c578ee4 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -722,6 +722,9 @@ class AnkiConnect: except AttributeError: self.media().trash_files([filename]) + @util.api() + def getMediaDirPath(self): + return os.path.abspath(self.media().dir()) @util.api() def addNote(self, note):