From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: how to convert org file: link path into shell path? Date: Sat, 28 Apr 2018 21:15:07 +0800 Message-ID: <87in8bjwv8.fsf@gmail.com> References: <87d0z2i0ka.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCPhD-0007xl-UX for emacs-orgmode@gnu.org; Sat, 28 Apr 2018 09:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fCPhA-0001Xc-MW for emacs-orgmode@gnu.org; Sat, 28 Apr 2018 09:15:23 -0400 Received: from [183.249.129.92] (port=4209 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fCPhA-0001Rk-67 for emacs-orgmode@gnu.org; Sat, 28 Apr 2018 09:15:20 -0400 In-reply-to: <87d0z2i0ka.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" 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-----