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

subed-waveform: add defcustoms for setting height/width of waveforms #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rodrigomorales1
Copy link

Increasing the dimensions of the waveforms helps me to quickly analyze the content of the waveform of the subtitle being edited, so this pull request introduces two variables which allow setting the height and width for the image that display the waveforms.

The two pairs of screenshots and code blocks below show how different configurations can set the size for the image that display the waveforms.

(setq subed-waveform-image-width 545)
(setq subed-waveform-image-height 34)

image

(setq subed-waveform-image-width 800)
(setq subed-waveform-image-height 100)

image

If you are a GNU/Linux user, you can use the command below to download a sample video with a sample subtitle from Wikimedia Commons.

rm -rf /tmp/subtitles \
  && mkdir /tmp/subtitles \
  && curl \
       --output /tmp/subtitles/video.ogv \
       'https://upload.wikimedia.org/wikipedia/commons/4/41/Creative_Commons_and_Commerce.ogv' \
  && curl \
       --data-urlencode 'format=json' \
       --data-urlencode 'action=query' \
       --data-urlencode 'prop=revisions' \
       --data-urlencode 'rvprop=content' \
       --data-urlencode 'rvslots=*' \
       --data-urlencode 'formatversion=2' \
       --data-urlencode 'titles=TimedText:Creative_Commons_and_Commerce.ogv.en.srt' \
       'https://commons.wikimedia.org/w/api.php' | jq --raw-output '.query.pages.[].revisions.[].slots.main.content' > /tmp/subtitles/video.en.srt

You can preview my changes by cloning the repository (first code block below), save the second code block below to /tmp/subtitles/init.el and use the commands in the third and fourth code block to launch Emacs.

git clone --depth 1 'https://github.com/rodrigomorales1/subed' /tmp/rodrigomorales1-subed
(add-to-list 'load-path "/tmp/rodrigomorales1-subed/subed")
(require 'subed-srt)
(require 'subed-waveform)
(add-hook 'subed-mode-hook 'subed-waveform-minor-mode)
(add-hook 'subed-mode-hook 'subed-enable-sync-player-to-point)
(add-hook 'subed-mode-hook 'subed-enable-loop-over-current-subtitle)
(add-hook 'subed-mode-hook 'subed-enable-replay-adjusted-subtitle)
emacs \
  --quick \
  --load /tmp/subtitles/init.el \
  --eval "(setq subed-waveform-image-width 545)" \
  --eval "(setq subed-waveform-image-height 34)" \
  --eval "(find-file \"/tmp/subtitles/video.en.srt\")"
emacs \
  --quick \
  --load /tmp/subtitles/init.el \
  --eval "(setq subed-waveform-image-width 800)" \
  --eval "(setq subed-waveform-image-height 100)" \
  --eval "(find-file \"/tmp/subtitles/video.en.srt\")"

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

Successfully merging this pull request may close these issues.

1 participant