cobalamin / obsidian-remarkable

Integrates the reMarkable tablet into an Obsidian workflow by letting users quickly capture and insert their drawings.
308 stars 20 forks source link

Can't get plug-in to work, despite reSnap working #8

Open alexnegron opened 2 years ago

alexnegron commented 2 years ago

Hi, hope to get the plug-in working, looks awesome! Trying to run this on a Mac M1. I believe I set up reSnap properly since calling ./reSnap.sh (tablet usb-connected) pulls up a capture of the tablet's screen in XQuartz.

Here's the error code from Obsidian.

plugin:obsidian-remarkable:5846 Found CM editor
plugin:obsidian-remarkable:29 Uncaught (in promise) Nonzero exitcode.
STDERR: /Users/alexnegron/reSnap.sh: line 177: : command not found
/Users/alexnegron/reSnap.sh: line 178: : command not found
/Users/alexnegron/reSnap.sh: line 188: : command not found

STDOUT: 
rejected @ plugin:obsidian-remarkable:29
processTicksAndRejections @ node:internal/process/task_queues:96
Promise.then (async)
step @ plugin:obsidian-remarkable:30
eval @ plugin:obsidian-remarkable:31
__awaiter @ plugin:obsidian-remarkable:27
tryInsertingDrawing @ plugin:obsidian-remarkable:5822
callback @ plugin:obsidian-remarkable:5728
yH @ app.js:1
e.executeCommand @ app.js:1
e.onTrigger @ app.js:1
e.handleKey @ app.js:1
e.handleKey @ app.js:1
t.handleKey @ app.js:1
e.onKeyEvent @ app.js:1

Given the errors in lines 177, 178, and 188 I'm led to believe it has something to do with lz4, feh, and ffmpeg? Calling which for each of these gives: /opt/homebrew/bin/lz4 /opt/homebrew/bin/feg /opt/homebrew/bin/ffmpeg

Not sure if its a path issue with these guys, or something else entirely.

cobalamin commented 2 years ago

Hmm, I'm not immediately sure how that's happening. Should probably work, but just to make sure, what's the output of command -v ffmpeg in your shell?

One thing you could maybe try is changing this line https://github.com/cobalamin/obsidian-remarkable/blob/master/main.ts#L96 in your local copy to const process = spawn(executable_path, args, {"shell": "/bin/bash"});.

alexnegron commented 1 year ago

Hi, sorry, haven't been up to date with things and sort of tabled RM stuff. Thanks for the help!

command -v ffmpeg returns /opt/homebrew/bin/ffmpeg

I made the suggested change now to the main.js file (this is the new one for the 1.1.1 release, installed via BRAT). The error I get now is

Uncaught (in promise) Nonzero exitcode.
STDERR: 
STDOUT: Usage: /Users/alexnegron/reSnap.sh [-l] [-d] [-n] [-v] [--source <ssh-host>] [--output <output-file>] [-h]
Examples:
  /Users/alexnegron/reSnap.sh                    # snapshot in portrait
  /Users/alexnegron/reSnap.sh -l                 # snapshot in landscape
  /Users/alexnegron/reSnap.sh -s 192.168.2.104   # snapshot over wifi
  /Users/alexnegron/reSnap.sh -o snapshot.png    # saves the snapshot in the current directory
  /Users/alexnegron/reSnap.sh -d                 # force display the file (requires feh)
  /Users/alexnegron/reSnap.sh -n                 # force don't display the file
  /Users/alexnegron/reSnap.sh -v                 # displays version
  /Users/alexnegron/reSnap.sh -h                 # displays help information (this)

rejected @ plugin:obsidian-remarkable:29
Promise.then (async)
step @ plugin:obsidian-remarkable:30
eval @ plugin:obsidian-remarkable:31
__awaiter @ plugin:obsidian-remarkable:27
tryInsertingDrawing @ plugin:obsidian-remarkable:5837
callback @ plugin:obsidian-remarkable:5743
NB @ app.js:1
e.executeCommand @ app.js:1
e.onTrigger @ app.js:1
e.handleKey @ app.js:1
e.handleKey @ app.js:1
t.handleKey @ app.js:1
e.onKeyEvent @ app.js:1
ryanmccool commented 1 year ago

Just wanted to pop a note here and say that I'm also having this problem. "Could not insert your rM drawing! Is your tablet connected and reachable at the configured address?"

I can confirm that everything works fine when I run reSnap manually via the terminal.

Any ideas?

alexnegron commented 1 year ago

I managed to fix the issue I was having. I'm not sure exactly why it works, or if it generalizes to the issue you may be having, but I'll explain what I did.

echo "$FFMPEG_ABS"

read and compress the data on the reMarkable

decompress and decode the data on this machine

ssh_cmd "$head_fb0 | $compress" | "${LZ4_ABS}" -d | "${FFMPEG_ABS}" -y \ -f rawvideo \ -pixel_format $pixel_format \ -video_size "$width,$height" \ -i - \ -vf "$filters" \ -frames:v 1 "$output_file"



- There are 2 notable changes I made: (1) I put in the absolute paths to ffmpeg and lz4, and (2) I deleted lines 175-178 in reSnap.sh. At first, I only did (1). When I would try inserting into Obsidian, it would work, no error was thrown, but the image would launch in XQuartz, get inserted into a rm file folder in Obsidian, but not get put into the actual note. Have no idea why. But deleting 175-178 solved this issue, and everything worked from there. 

Hope this helps! Sorry if this was a bit hacky, I have very little idea what I'm doing with all this; sort of just tried different things until it finally worked.