twitch.el 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. (defcustom wi-helm-wigust-stream-urls
  2. '("https://www.twitch.tv/nekrovim"
  3. "https://www.twitch.tv/entr_ru"
  4. "https://www.youtube.com/user/streamguild"
  5. "https://www.twitch.tv/artgameslp"
  6. "https://www.youtube.com/user/ArtGamesLP")
  7. "List of URLs passed to `wi-helm-wigust-stream'.")
  8. (defun wi-helm-wigust-stream (func)
  9. "Open a streaming video URL in Chromium or Streamlink with Helm."
  10. (interactive (list
  11. (let ((engine (completing-read "Engine (chromium by default): "
  12. '(chromium streamlink))))
  13. (if (string-empty-p engine)
  14. "chromium"
  15. engine))))
  16. (helm :sources (helm-build-sync-source "urls"
  17. :action (lambda (candidate)
  18. (funcall (cond ((string-equal func "chromium")
  19. 'browse-url-chromium)
  20. ((string-equal func "streamlink")
  21. 'browse-url-streamlink))
  22. candidate))
  23. :candidates wi-helm-wigust-stream-urls
  24. :fuzzy-match t)
  25. :buffer "*helm urls*"))
  26. (defun erc-twitch ()
  27. "Open a current buffer with `browse-url-streamlink'"
  28. (interactive)
  29. (let ((url (concat "https://twitch.tv/"
  30. (car (last (split-string (buffer-name (current-buffer))
  31. "#"))))))
  32. (message (concat "Open stream: " url))
  33. (browse-url-streamlink url)))