Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a position for an org-fc-audio card does not work #127

Open
daraul opened this issue May 3, 2024 · 2 comments
Open

Setting a position for an org-fc-audio card does not work #127

daraul opened this issue May 3, 2024 · 2 comments

Comments

@daraul
Copy link

daraul commented May 3, 2024

I've installed org-fc-audio, and can confirm that it works -- see my example card below.

* Just a test :fc:
:PROPERTIES:
:FC_CREATED: 2024-05-03T21:19:22Z
:FC_TYPE:  text-input
:FC_ALGO:  sm2
:ID:       c0a80c84-85bd-4028-b719-69b39be3d679
:FC_AUDIO_BEFORE_SETUP_FRONT: /Users/daraul/Test\ Method.mp3
:FC_AUDIO_AFTER_SETUP_FRONT: /Users/daraul/Test\ Method.mp3
:END:
:REVIEW_DATA:
| position | ease | box | interval | due                  |
|----------+------+-----+----------+----------------------|
| front    | 2.50 |   0 |     0.00 | 2024-05-03T21:19:22Z |
:END:
Foo

I was under the impression that I'd be able to set the position of the audio, but so far my attempts have silently failed:

:FC_AUDIO_BEFORE_SETUP_FRONT: /Users/daraul/Test\ Method.mp3#4:44
:FC_AUDIO_BEFORE_SETUP_FRONT: /Users/daraul/Test\ Method.mp3::4:44
:FC_AUDIO_BEFORE_SETUP_FRONT: /Users/daraul/Test\ Method.mp3:4:44:44

Am I making some syntax error, or is it not possible to start playback at a particular position?

@l3kn
Copy link
Owner

l3kn commented May 4, 2024

I've tried to implement this but couldn't find a way that's flexible and stable yet.

(defun org-fc-audio-play-file (file speed)
  "Play the audio FILE at SPEED."
  (org-fc-audio-stop)
  (setq org-fc-audio-last-file file)
  (let* ((tokens (split-string file " "))
         (path (car tokens))
         (range (when (eq (length tokens) 2)
                  (split-string (cadr tokens) "-")) )
         (command
          (if range
              (format
               "mpv %s --speed=%f --start=%s --end=%s"
               path speed (car range) (cadr range))
            (format "mpv %s --speed=%f" path speed))))

This approach will not work in your case because the filename you're using has a space in it and there's no end range.

We can try coming up with a better way of passing extra arguments that will ideally work for different playback programs.

One idea would be something like :FC_AUDIO_BEFORE_SETUP_FRONT: /Users/daraul/Test\ Method.mp3 :start 1:23 :end 4:56 where the space in the filename can be correctly parsed with a bit of effort.

@daraul
Copy link
Author

daraul commented May 4, 2024

I think passing extra arguments would be the better option. That way, you don't have to worry too much about spaces in the file path, and it'd be easier to discover this functionality by inspecting the package's arguments with describe-variable.

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

No branches or pull requests

2 participants