mpv2oboeru

mpv helpers to create flashcards from movies and TV shows
git clone anongit@rnpnr.xyz:mpv2oboeru.git
Log | Files | Refs | Feed | README | LICENSE

Commit: b259636dac252fa4db8d30d7cca671fcefe307cd
Parent: dc26c46678858d814683346f0437d41e79c51ce4
Author: Ren Tatsumoto
Date:   Sun, 15 Nov 2020 23:32:56 +0300

guess alternative collection path on mac

see #11

Diffstat:
Msubs2srs.lua | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -538,6 +538,16 @@ end local function init_platform_nix() local self = {} local clip = is_running_macOS() and 'LANG=en_US.UTF-8 pbcopy' or 'xclip -i -selection clipboard' + local collection_path_linux = string.format( + '%s/.local/share/Anki2/%s/collection.media/', + os.getenv('HOME'), + config.anki_user + ) + local collection_path_mac = string.format( + '%s/Library/Application Support/Anki2/%s/collection.media', + os.getenv('HOME'), + config.anki_user + ) self.copy_to_clipboard = function(text) local handle = io.popen(clip, 'w') @@ -546,7 +556,7 @@ local function init_platform_nix() end self.construct_collection_path = function() - return string.format('%s/.local/share/Anki2/%s/collection.media/', os.getenv('HOME'), config.anki_user) + return is_dir(collection_path_mac) and collection_path_mac or collection_path_linux end self.curl_request = function(request_json, completion_fn)