help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: subtitles.el - functions to manipulate an .srt (subripper) file.


From: Ehud Karni
Subject: Re: subtitles.el - functions to manipulate an .srt (subripper) file.
Date: Wed, 20 May 2009 13:30:04 +0300

On Mon, 18 May 2009 15:16:54 Uwe Brauer wrote:
>
> >>>>> "Ehud" == Ehud Karni <ehud@unix.mvs.co.il> writes:
>
>    > subtitles.el has some functions to manipulate movie subtitle timing in
>    > an .srt file (i.e. subripper subtitles).
> Hello Ehud,
>
> Thanks that is great. May I suggest to have a mayor mode with
> keybindings for srt files?

[moved to help-gnu-emacs, the discussion is off topic for emacs-sources]

I may do it some time adding syntax highlighting and key bindings.
You can take my source and do it yourself.
For now, I use M-x<function>. Do you have suggestions for key bindings ?

Ehud.

BTW. I have added a new function:

(defun srt-all-to-3lines ()
  "Make all subtitles 3 lines by adding empty lines when needed.
It makes comparing subtitles side by side easier."
  (interactive)
       (let ((svd-pos (point-marker))              ;; saved position
             (last (point-min))
             lns)
           (goto-char (point-min))
           (while (srt-next-N-time)
               (setq lns (count-lines last (point)))
               (cond
                   ((= lns 4)                              ;; only 1 line in 
last subtitle
                           (replace-match (concat "\n\n\n" (match-string 0))))
                   ((= lns 5)                              ;; 2 lines in last 
subtitle
                           (replace-match (concat "\n\n" (match-string 0))))
                   ((= lns 6)                              ;; 3 lines in last 
subtitle
                           (replace-match (concat "\n" (match-string 0)))))
               (setq last (1- (point))))
           (goto-char svd-pos)))



--
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry




reply via email to

[Prev in Thread] Current Thread [Next in Thread]