* Need help on write new link type for link URI.
@ 2018-04-14 9:45 stardiviner
2018-04-26 23:34 ` Bastien
2018-04-28 13:15 ` how to convert org file: link path into shell path? stardiviner
0 siblings, 2 replies; 5+ messages in thread
From: stardiviner @ 2018-04-14 9:45 UTC (permalink / raw)
To: org-mode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I have following code, check out the FIXME: comment tag.
How to get the correct link here?
,----
| ;;; `video:filename.mp4::start_timestamp'
| (defcustom org-video-link-open-command "mplayer"
| "Specify the program for openning video: link."
| :type 'string)
|
| (defun org-video-link-open (uri)
| "Open video file `URI' with video player."
| (let* ((list (split-string uri "::"))
| (path (car list))
| (start-timstamp (cadr list)))
| (shell-command
| (format
| "%s -ss %s %s"
| ;; FIXME: path has issue.
| org-video-link-open-command start-timstamp (org-link-unescape path)))))
|
| (org-link-set-parameters "video"
| :follow #'org-video-link-open
| :complete #'org-file-complete-link)
`----
- --
[ stardiviner ] don't need to convince with trends.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrRzaUACgkQG13xyVro
msP3nwf+JXnDDnnAgBuvBjkATJWuNryX5twTex/LBrqq9IP66j4DUC9ypmYIgpJ+
zVt/I1u7niGnyiMOtNotG7VJTae68HeDFQhMdURycI3gG6gUeoQw21bscQ7PYyl3
9Bx6xnLsJ6/XkPd3OnKbuNmI91B7b8x7KGCc6we2Atz27QKDPu9Z5Bcq2mdpsIBs
U8vXH/cNeFC1n10uCMW08WhSpiRoqPgtzYUHDSywWcl38bh+9PUwJxiwEKI/wgrh
OJXbLoiNxFakOcxvKwTrFEGWBEen8hMBOzAIm1L4y0eTUPbJiPO8sbOH2zCBokVZ
Wbk1Y7N1QJMTWZIpS86RmS5ZPYVxng==
=LYgd
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Need help on write new link type for link URI.
2018-04-14 9:45 Need help on write new link type for link URI stardiviner
@ 2018-04-26 23:34 ` Bastien
2018-04-28 13:15 ` how to convert org file: link path into shell path? stardiviner
1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2018-04-26 23:34 UTC (permalink / raw)
To: stardiviner; +Cc: org-mode
Hi,
stardiviner <numbchild@gmail.com> writes:
> How to get the correct link here?
Please be more explicit on what your are trying to achieve, why you
think your solution is correct, what does not work in your solution
and what you did to try to make it work. This will boost the odds
of getting an answer.
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to convert org file: link path into shell path?
2018-04-14 9:45 Need help on write new link type for link URI stardiviner
2018-04-26 23:34 ` Bastien
@ 2018-04-28 13:15 ` stardiviner
2018-04-28 13:28 ` Bastien
1 sibling, 1 reply; 5+ messages in thread
From: stardiviner @ 2018-04-28 13:15 UTC (permalink / raw)
To: org-mode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I try to add a new link like this:
[[video:/path/to/file/video.mp4::00:13:05]]
The following "00:13:05" is a timestamp, mplayer support play video
start from a specific timestamp. So I use following code snippte:
> I have following code, check out the FIXME: comment tag.
> How to get the correct link here?
> ,----
> | ;;; `video:filename.mp4::start_timestamp'
> | (defcustom org-video-link-open-command "mplayer"
> | "Specify the program for openning video: link."
> | :type 'string)
> |
> | (defun org-video-link-open (uri)
> | "Open video file `URI' with video player."
> | (let* ((list (split-string uri "::"))
> | (path (car list))
> | (start-timstamp (cadr list)))
> | (shell-command
> | (format
> | "%s -ss %s %s"
> | ;; FIXME: path has issue.
> | org-video-link-open-command start-timstamp (org-link-unescape path)))))
> |
> | (org-link-set-parameters "video"
> | :follow #'org-video-link-open
> | :complete #'org-file-complete-link)
> `----
>
But it does not open video file. After edebug, seems error on file path.
The problem is how to convert org file: link path into shell path. When
org file link path contains space " " or colon ":", comma "," etc
special characters. How to escape them safely into shell file path?
- --
[ stardiviner ] don't need to convince with trends.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrkc9sACgkQG13xyVro
msO/6Af+Ogpk2NnrNjXT4h6y8dUrKsSNkKxnG4XAThnWIHuLDGqgjxQeRQ+yqJbz
UYD8PImLCADtpFiJM5AU8lnj0CN9Nf3AOgzfXNuMpmkD+YrmsBVAKM+mhTkW2K8j
Gdhtl453/wdd5uQI5GeY5xXg/Get8IeuCv3WMEAaknB2OUhclbSJkwGPfN7hz8me
Gq5E86rTVuITvDYJJxYFJLtN6L6qN9NhlX3MHPxi2v+qZXeOibX5GBXl/c+6DvwO
gdMo7eFi/WCQ2JuQKGYycroAgV8gD5do4y8QmzQ3iiYAsppquOkV4f73vZ3fWS+0
TPWkpXcffbqBIWDoiAYRAy9cxYzEUg==
=d3kl
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to convert org file: link path into shell path?
2018-04-28 13:15 ` how to convert org file: link path into shell path? stardiviner
@ 2018-04-28 13:28 ` Bastien
2018-04-29 14:34 ` stardiviner
0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2018-04-28 13:28 UTC (permalink / raw)
To: stardiviner; +Cc: org-mode
Hi,
stardiviner <numbchild@gmail.com> writes:
> The problem is how to convert org file: link path into shell path.
Maybe by replacing "%s -ss %s %s" by "%s -ss %s \"%s\"", i.e. adding
double-quotes around the filename?
BTW, the video link works fine on a few files I tried on my disk.
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to convert org file: link path into shell path?
2018-04-28 13:28 ` Bastien
@ 2018-04-29 14:34 ` stardiviner
0 siblings, 0 replies; 5+ messages in thread
From: stardiviner @ 2018-04-29 14:34 UTC (permalink / raw)
To: Bastien; +Cc: org-mode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Bastien <bzg@gnu.org> writes:
> Maybe by replacing "%s -ss %s %s" by "%s -ss %s \"%s\"", i.e. adding
> double-quotes around the filename?
Thanks, Bastien, this solved my problem.
- --
[ stardiviner ] don't need to convince with trends.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAlrl1+QACgkQG13xyVro
msN2LggAtuQPkvRlZC/4k9y8uhbKrx+ohU9upQHWz7sFxbLDb0xqI9XUN8dKsUXP
P9VxjrHwdwK5rnknl4GYmlPKy86EO2dFhhkuULbB1n7RjLJIvGYZqru+ub+ZLRqo
8n9Ho8lK+OyYwP+hDNthlroiHW7WuKhtKp78TLJHdvxdGPjfY0U+diyN/1v6sL97
E8DQtJJn8sk9QGvMVxtmXD4wW73IipQTV1jvevYTYsfC1fitI9ePgVs4le3Z8ScF
9+lyOxakGvTwZahyRjYEmNijz1uSfC72ACI1im0Kk7UJFW3IAdH2xdx6UfXl/wRM
wSag86HVghWfffiXRO8+KaqXS11q+Q==
=fBdS
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-29 14:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-14 9:45 Need help on write new link type for link URI stardiviner
2018-04-26 23:34 ` Bastien
2018-04-28 13:15 ` how to convert org file: link path into shell path? stardiviner
2018-04-28 13:28 ` Bastien
2018-04-29 14:34 ` stardiviner
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).