diff options
Diffstat (limited to '.emacs.d/modules/thanos-multimedia.el')
-rw-r--r-- | .emacs.d/modules/thanos-multimedia.el | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/.emacs.d/modules/thanos-multimedia.el b/.emacs.d/modules/thanos-multimedia.el deleted file mode 100644 index 036b99c..0000000 --- a/.emacs.d/modules/thanos-multimedia.el +++ /dev/null @@ -1,120 +0,0 @@ -;;; thanos-multimedia.el --- -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Thanos Apollo - -;; Author: Thanos Apollo <[email protected]> -;; Keywords: - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <https://www.gnu.org/licenses/>. - -;;; Commentary: -;; ╭━━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╭━━━╮ -;; ┃╭╮╭╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━╮┃╱╱╱╱╱┃┃┃┃╱╱╱╱╱╱╱╱┃╭━━╯ -;; ╰╯┃┃╰┫╰━┳━━┳━╮╭━━┳━━╮┃┃╱┃┣━━┳━━┫┃┃┃╭━━╮╱╱╱╱┃╰━━┳╮╭┳━━┳━━┳━━╮ -;; ╱╱┃┃╱┃╭╮┃╭╮┃╭╮┫╭╮┃━━┫┃╰━╯┃╭╮┃╭╮┃┃┃┃┃╭╮┃╭━━╮┃╭━━┫╰╯┃╭╮┃╭━┫━━┫ -;; ╱╱┃┃╱┃┃┃┃╭╮┃┃┃┃╰╯┣━━┃┃╭━╮┃╰╯┃╰╯┃╰┫╰┫╰╯┃╰━━╯┃╰━━┫┃┃┃╭╮┃╰━╋━━┃ -;; ╱╱╰╯╱╰╯╰┻╯╰┻╯╰┻━━┻━━╯╰╯╱╰┫╭━┻━━┻━┻━┻━━╯╱╱╱╱╰━━━┻┻┻┻╯╰┻━━┻━━╯ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ -;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ -;;; Code: - -;; EMMS -(require 'emms) -(autoload 'emms-smart-browse "emms-browser.el" "Browse with EMMS" t) - -(with-eval-after-load 'emms - (emms-all) - (setq emms-source-file-default-directory "~/Music" - emms-info-asynchronously t - emms-show-format "♪ %s") - (emms-default-players)) - -(setf emms-player-mpv-parameters nil) - -(define-key emms-playlist-mode-map (kbd "A") #'emms-add-directory-tree) - -(defun yeetube-download-vimeo-videos () - "Download videos from vimeo services." - (interactive) - (let ((url "") - (name "") - (download-counter 1)) - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) - (setf download-counter (1+ download-counter)) - (call-process-shell-command - (format - "yt-dlp '%s' -o '%s'" - (replace-regexp-in-string "\\.json" ".m3u8" url) name) - nil 0))))) - -(defun yeetube-download-videos-ffmpeg () - "Download videos using ffmpeg." - (interactive) - (let ((url "") - (name "") - (download-counter 1) - (stored-contents nil)) - ;; Read links and names until "q" is entered - (while (not (string= url "q")) - (setf url (read-string "Enter URL (q to quit): ")) - (unless (string= url "q") - (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) - (push (cons url name) stored-contents) - (setf download-counter (1+ download-counter)))) - ;; Process the collected links and names - (dolist (pair stored-contents) - (let ((url (car pair)) - (name (cdr pair))) - (async-shell-command - (format - "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'" - url name)))))) - -(setf yeetube-results-limit 20 - yeetube-mpv-disable-video t) - -(defun yeetube-play-url (url) - "Open URL using yeetube-player." - (interactive "sURL:") - (let ((media-player (executable-find (symbol-name yeetube-player)))) - (unless media-player - (error (format "%s not found." media-player))) - (when (string-prefix-p "http" url) - (setf yeetube-last-played url) - (if (eq yeetube-player 'mpv) - (yeetube-start-mpv-process url) - (yeetube-start-process - (format "%s \"%s\"" media-player - (replace-regexp-in-string "\\byewtu\\.be\b" "youtube.com" url))))))) - -(defvar-keymap thanos/yeetube-map - :doc "Personal yeetube map." - "s" #'yeetube-search - "b" #'yeetube-play-saved-video - "d" #'yeetube-download-videos - "C-d" #'yeetube-download-vimeo-videos - "p" #'yeetube-mpv-toggle-pause - "v" #'yeetube-mpv-toggle-no-video-flag - "C-p" #'yeetube-mpv-toggle-video - "k" #'yeetube-remove-saved-video) - -(global-set-key (kbd "C-c y") thanos/yeetube-map) - - - -(provide 'thanos-multimedia) -;;; thanos-multimedia.el ends here |