;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311\312\313&\210\314\315\316\317\320DD\321\322\323\312\305&\210\314\324\316\317\325DD\326\322\317\312\305&\210\314\327\316\317\330DD\331\322\332\312\305&\210\314\333\316\317\334DD\335\322\317\312\305&\210\336\337\340\341\312\305%\210\336\342\343\344\312\305%\210\336\345\346\347\312\305%\210\336\350\351\352\312\305%\207" [require dom seq url-util custom-declare-group lyrics nil "Show lyrics." :prefix "lyrics-" :group multimedia custom-declare-variable lyrics-directory funcall function #[0 "\300\301!\207" [expand-file-name "~/.lyrics"] 2] "Directory where to the lyrics will be stored.\n\nIt defaults to `~/.lyrics' since other MPD clients (e.g. ncmpc)\nalso use that location." :type (directory :must-match t) lyrics-normalize-function #[0 "\300\207" [lyrics-capitalize] 1] "Function used to normalize lyrics filename." lyrics-backend #[0 "\300\207" [lyrics-lyricswiki] 1] "Function used to get lyrics.\n\nThis function should receive three parameters: Artist, Song,\nBuffer (optional), and ultimately call `lyrics-show' to show the\nlyrics." (radio (function-item lyrics-azlyrics) (function-item lyrics-lyricswiki) (function-item lyrics-musixmatch) (function :tag "Function")) lyrics-current-song-function #[0 "\300\207" [nil] 1] "Function to fetch the current playing song.\n\nShould return a list of the form: (ARTIST SONG)." custom-declare-face lyrics-face-song ((t :inherit font-lock-constant-face)) "Face for song titles." lyrics-face-artist ((t :inherit font-lock-constant-face)) "Face for song artist." lyrics-face-lyrics ((t :inherit default)) "Face for song lyrics." lyrics-face-item ((t :weight bold)) "Face for lyrics item."] 8) (defvar lyrics-song nil nil) (make-variable-buffer-local 'lyrics-song) (defvar lyrics-artist nil nil) (make-variable-buffer-local 'lyrics-artist) (defvar lyrics-song-history nil) (defvar lyrics-artist-history nil) (defvar lyrics-buffer-name "*Lyrics*") (defvar lyrics-newlines-separator 1) (defconst lyrics-node-tag-ignore '(comment script)) (byte-code "\300\301\302\"\210\300\303\304\301#\210\300\305\306\301#\207" [define-error lyrics-error "Unknown lyrics error" lyrics-not-found "Lyrics not found" lyrics-backend-error "Lyrics backend error"] 4) #@35 Capitalize a STRING. (fn STRING) (defalias 'lyrics-capitalize #[257 "\300\301\302!\"\303\304\305#\207" [#[257 "\211\300\301O\226\301\302O\227P\207" [0 1 nil] 5 "\n\n(fn STR)"] mapcar split-string " " mapconcat identity] 8 (#$ . 2361)]) #@55 Clean duplicate blank lines from STRING. (fn STRING) (defalias 'lyrics-clean-blank-lines #[257 "\300\301\302#\207" [replace-regexp-in-string "\\(?:\n[[:space:]]?\\)\\{2\\}" "\n"] 5 (#$ . 2609)]) #@78 Return a filename used to cache lyrics from a ARTIST SONG. (fn ARTIST SONG) (defalias 'lyrics-cache-filename #[514 "\301\302R\303\"\207" [lyrics-directory " - " ".txt" expand-file-name] 6 (#$ . 2812)]) #@94 Return all the text bits from NODE concatenated by SEPARATOR. (fn NODE &optional SEPARATOR) (defalias 'lyrics-node-text #[513 "\300\301\211@:\203\211@AA\262\202\211AA\262\"\206\302\303\304#\207" [cl-remove-if-not stringp " " mapconcat identity] 8 (#$ . 3025)]) #@174 Return all textual data under NODE concatenated with SEPARATOR in-between. Similar to `dom-texts' but ignores `lyrics-node-tag-ignore' tags. (fn NODE &optional SEPARATOR) (defalias 'lyrics-node-texts #[513 "\300\301\302\"\211@:\203\211@AA\262\202\211AA\262\"\206 \303\304\305#\207" [mapcar make-closure #[257 "\211;\203\207\211\211@:\203\211@@\262\202\211@\262\302=\203 \303\207\211\211@:\203/\211@@\262\2023\211@\262 \235\203:\304\207\305\300\"\207" [V0 lyrics-node-tag-ignore br "\n" "" lyrics-node-texts] 4 "\n\n(fn ELEM)"] " " mapconcat identity] 8 (#$ . 3306)]) #@80 Return the parsed xml from a `url-retrieve' BUFFER response body. (fn BUFFER) (defalias 'lyrics-url-retrieve-parse-xml #[257 "r\211q\210b\210\301\302!\203\302`Td\"\202\303\304\305\")\207" [url-http-end-of-headers fboundp libxml-parse-xml-region signal lyrics-error ("Emacs without xml support")] 4 (#$ . 3908)]) #@81 Return the parsed html from a `url-retrieve' BUFFER response body. (fn BUFFER) (defalias 'lyrics-url-retrieve-parse-html #[257 "r\211q\210b\210\301\302!\203\302`Td\"\202\303\304\305\")\207" [url-http-end-of-headers fboundp libxml-parse-html-region signal lyrics-error ("Emacs without xml support")] 4 (#$ . 4232)]) #@73 Save ARTIST SONG LYRICS in `lyrics-directory'. (fn ARTIST SONG LYRICS) (defalias 'lyrics-save #[771 "\3001%\301\302\303\"r\211q\210\304\305\"\216c\210\306\307\211\310\"\307\311%*\2620\207\312\313!!\207" [(file-error) generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] write-region nil lyrics-cache-filename 0 message error-message-string] 10 (#$ . 4559)]) #@85 Read the artist and song, is ASK is non nil will show a prompt. (fn &optional ASK) (defalias 'lyrics-read-current-song #[256 "\301\211\302!\203%\3031 \211@\211\262A@\262\2620\210\202%\304\305\"\266\2045\2035\211\2035D\207\306\307\310#\306\311\312#D\207" [lyrics-current-song-function nil functionp (debug error) message "Error while loading song/artist with `lyrics-current-song-function': %S" read-string "Artist: " lyrics-artist-history "Song: " lyrics-song-history] 8 (#$ . 4992)]) #@155 Show ARTIST SONG LYRICS in a BUFFER. If SAVE is non nil will save the lyrics into the `lyrics-directory'. (fn ARTIST SONG LYRICS &optional BUFFER SAVE) (defalias 'lyrics-show #[1283 "\211\203\n\305#\210r\306\206!q\210\307\310 \210\311\312\313\314\315\316#\313\315\317##\311\312\313\320\315\316#\313 \315\321##\322\n\323\"\313\315\324#\261\210eb\210\325 \210\326p!*\207" [lyrics-buffer-name inhibit-read-only lyrics-newlines-separator lyrics-song lyrics-artist lyrics-save get-buffer-create t erase-buffer format "%s %s\n" propertize "Song:" face lyrics-face-item lyrics-face-song "Artist:" lyrics-face-artist make-string 10 lyrics-face-lyrics lyrics-show-mode display-buffer] 13 (#$ . 5506)]) #@174 Revert an lyrics buffer. The function receives two arguments _IGNORE-AUTO and NOCONFIRM, which are the arguments that `revert-buffer' received. (fn IGNORE-AUTO NOCONFIRM) (defalias 'lyrics-show-revert-buffer #[514 "`\204\302\303\304 #!\205 \305\306 #\210\307 p#\210\310 \210\211b\207" [lyrics-artist lyrics-song y-or-n-p format "Reload lyrics for song \"%s - %s\"? " message "Loading lyrics for song \"%s - %s\"?" lyrics force-mode-line-update] 8 (#$ . 6228)]) #@46 Local keymap for `lyrics-show-mode' buffers. (defvar lyrics-show-mode-map (byte-code "\301 \302\"\210\303\304\305#\210\303\306\307#\210\303\310\311#\210\303\312\313#\210\207" [special-mode-map make-sparse-keymap set-keymap-parent define-key "e" lyrics-edit "j" next-line "k" previous-line "/" isearch-forward] 5) (#$ . 6704)) (defvar lyrics-show-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [lyrics-show-mode-hook variable-documentation put "Hook run after entering Lyrics mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp lyrics-show-mode-map definition-name lyrics-show-mode] 4) (defvar lyrics-show-mode-map (make-sparse-keymap)) (byte-code "\301\302N\204\303\301\302\304\305!#\210\306\307!\204\303\307\310\311#\210\312\313 !\210\307\302N\204-\303\307\302\304\314!#\210\306\300!\204B\303\300\310\311#\210\315\316\300\317\"\210!\210\300\302N\204P\303\300\302\304\320!#\210\303\311\321\322#\207" [lyrics-show-mode-abbrev-table lyrics-show-mode-map variable-documentation put purecopy "Keymap for `lyrics-show-mode'." boundp lyrics-show-mode-syntax-table definition-name lyrics-show-mode (lambda (def-tmp-var) (defvar lyrics-show-mode-syntax-table def-tmp-var)) make-syntax-table "Syntax table for `lyrics-show-mode'." (lambda (def-tmp-var) (defvar lyrics-show-mode-abbrev-table def-tmp-var)) define-abbrev-table nil "Abbrev table for `lyrics-show-mode'." derived-mode-parent special-mode] 5) #@237 A major mode for showing lyrics. \{lyrics-show-mode-map} In addition to any hooks its parent mode `special-mode' might have run, this mode runs the hook `lyrics-show-mode-hook', as the final or penultimate step during initialization. (defalias 'lyrics-show-mode #[0 "\306\300!\210\307\310 \210\311\312\310\313N\203\314\311\313\310\313N#\210\315 !\204'\316 \317 \"\210\320\f!\211\2035\211\321 =\203;\322\f\323 \"\210\210\324 \325\"\204R %=\204R\326 \325%C#\210\327 !\210\330\f!\210 %\331&\307\211'(\332\333!\334\335\336\337\340\257\306\341!\210\342!)\343\344!\207" [delay-mode-hooks major-mode mode-name lyrics-show-mode-map lyrics-show-mode-syntax-table lyrics-show-mode-abbrev-table make-local-variable t special-mode lyrics-show-mode "Lyrics" mode-class put keymap-parent set-keymap-parent current-local-map char-table-parent standard-syntax-table set-char-table-parent syntax-table abbrev-table-get :parents abbrev-table-put use-local-map set-syntax-table nil default-value mode-line-buffer-identification " {" lyrics-song " - " lyrics-artist "}" revert-buffer-function lyrics-show-revert-buffer run-mode-hooks lyrics-show-mode-hook local-abbrev-table buffer-auto-save-file-name truncate-lines buffer-read-only] 7 (#$ . 8273) nil]) #@98 Process lyrics from LyricWiki . (fn ARTIST SONG &optional BUFFER) (defalias 'lyrics-lyricswiki #[770 "\300\301\302\303\304#!\305\301\302\303\304 #!R\306\307E#\207" ["http://lyrics.wikia.com/api.php?fmt=xml&action=lyrics&song=" url-hexify-string replace-regexp-in-string " " "_" "&artist=" url-retrieve lyrics-lyricswiki-api-callback] 11 (#$ . 9536)]) #@160 Callback for LyricWiki backend, check if STATUS is erred. Receives ARTIST, SONG, and the BUFFER to show the lyrics. (fn STATUS ARTIST SONG &optional BUFFER) (defalias 'lyrics-lyricswiki-api-callback #[1027 "\300\301\"\203\302\303\300\301\"!!\207\304p!\305\306AA\"A@\305\307AA\"A@\310\230\2033\311\312D\"\207\313$\207" [plist-get :error message error-message-string lyrics-url-retrieve-parse-xml assoc-default lyrics url "Not found" signal lyrics-not-found lyrics-lyricswiki-extract] 12 (#$ . 9935)]) #@94 Display lyrics lyrics-wiki URL ARTIST SONG in BUFFER. (fn URL ARTIST SONG &optional BUFFER) (defalias 'lyrics-lyricswiki-extract #[1027 "\300\301\302$\"\207" [url-retrieve make-closure #[257 "\303\304\"\203\305\306\303\304\"!!\207\307p!\310\311\"\312\313\314\315\"!!\316\300\301\302\317%\207" [V0 V1 V2 plist-get :error message error-message-string lyrics-url-retrieve-parse-html dom-by-class "lyricbox" string-trim lyrics-clean-blank-lines lyrics-node-texts "\n" lyrics-show save] 10 "\n\n(fn STATUS)"]] 11 (#$ . 10463)]) #@98 Process lyrics from AZLyrics . (fn ARTIST SONG &optional BUFFER) (defalias 'lyrics-azlyrics #[770 "\300\301\"\302E#\207" [url-retrieve lyrics-azlyrics-url lyrics-azlyrics-page-callback] 9 (#$ . 11007)]) #@59 Return an AZLyrics url for ARTIST SONG. (fn ARTIST SONG) (defalias 'lyrics-azlyrics-url #[514 "\300\301\302!!#\207" [#[257 "\300\301\302#\227\207" [replace-regexp-in-string "[[:space:][:punct:]]+" ""] 5 "\n\n(fn STRING)"] format "https://www.azlyrics.com/lyrics/%s/%s.html"] 8 (#$ . 11253)]) #@159 Callback for AZLyrics backend, check if STATUS is erred. Receives ARTIST, SONG, and the BUFFER to show the lyrics. (fn STATUS ARTIST SONG &optional BUFFER) (defalias 'lyrics-azlyrics-page-callback #[1027 "\301\302\"\211\203\303U\203\304\305D\"\207\306\307!!\207\310p!\311\312\313\314\"\211@:\2033\211@AA\262\2028\211AA\262\"\315\316\317\320\"!!\321\322%\207" [url-http-response-status plist-get :error 404 signal lyrics-not-found message error-message-string lyrics-url-retrieve-parse-html seq-find #[257 "\211;?\2054\211\211@:\203\211@@\262\202\211@\262\300=\2054\211\211@:\203.\211@A@\262\2023\211A@\262?\207" [div] 3 "\n\n(fn NODE)"] dom-by-class "col-xs-12 col-lg-8 text-center" string-trim lyrics-clean-blank-lines lyrics-node-texts "\n" lyrics-show save] 14 (#$ . 11558)]) #@102 Process lyrics from MusicMatch . (fn ARTIST SONG &optional BUFFER) (defalias 'lyrics-musixmatch #[770 "\300\301\"\302E#\207" [url-retrieve lyrics-musixmatch-url lyrics-musixmatch-page-callback] 9 (#$ . 12380)]) #@50 Return an url for ARTIST SONG. (fn ARTIST SONG) (defalias 'lyrics-musixmatch-url #[514 "\300\301\302!!#\207" [#[257 "\300\301\302\303\300\304\305#!#\207" [replace-regexp-in-string "['/[:space:]]+" "-" string-trim "[].,:+!?&()[-]" " "] 9 "\n\n(fn STRING)"] format "https://www.musixmatch.com/lyrics/%s/%s"] 8 (#$ . 12636)]) #@161 Callback for MusicMatch backend, check if STATUS is erred. Receives ARTIST, SONG, and the BUFFER to show the lyrics. (fn STATUS ARTIST SONG &optional BUFFER) (defalias 'lyrics-musixmatch-page-callback #[1027 "\302\303\"\211\203\304U\203\305\306D\"\207\307\310!!\207\311p!\312\313\"\314\315\316\"\317\320\321#\266\202!\211\322\323\324\325#)\266\204\203J\305\306D\"\207\326\327%\207" [url-http-response-status inhibit-changing-match-data plist-get :error 404 signal lyrics-not-found message error-message-string lyrics-url-retrieve-parse-html dom-by-class "mxm-lyrics__content" string-trim mapcar lyrics-node-texts "\n\n" mapconcat identity "\\`[ \n ]*\\'" nil t string-match lyrics-show save] 16 (#$ . 12973)]) #@66 Edit ARTIST SONG LYRICS in `lyrics-directory'. (fn ARTIST SONG) (defalias 'lyrics-edit #[514 "\300\301\"!\207" [find-file lyrics-cache-filename] 6 (#$ . 13722) (lyrics-read-current-song current-prefix-arg)]) #@83 Browse lyrics wiki from ARTIST SONG in BUFFER. (fn ARTIST SONG &optional BUFFER) (defalias 'lyrics #[770 "\302!\203!\262!\262\303\304\"!\2039\305\306\307\"r\211q\210\310\311\"\216\312\304\"!\210\313 *\262\314$\207 #\207" [lyrics-normalize-function lyrics-backend functionp file-exists-p lyrics-cache-filename generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents buffer-string lyrics-show] 9 (#$ . 13939) (lyrics-read-current-song current-prefix-arg)]) (provide 'lyrics)