adding rust compilation pieces to compile errors

This commit is contained in:
Chris Cochrun 2024-04-17 10:08:58 -05:00
parent b759b18c8b
commit a05cc4363b
3 changed files with 47 additions and 20 deletions

View file

@ -13,7 +13,16 @@
(define-derived-mode lumina-mode tabulated-list-mode "lumina:songs"
"A mode for working with the lumina database and updating and adding songs"
(setf tabulated-list-format ['("Title" 10 t) '("Lyrics" 30 nil) '("Author" 10 t) '("CCLI" 7 nil) '("B" 1 nil) '("BT" 10 nil) '("h" 1 nil) '("v" 1 nil) '("f" 10 nil) '("fs" 2 nil)]))
(setf tabulated-list-format ['("Title" 10 t)
'("Lyrics" 30 nil)
'("Author" 10 t)
'("CCLI" 7 nil)
'("B" 1 nil)
'("BT" 10 nil)
'("h" 1 nil)
'("v" 1 nil)
'("f" 10 nil)
'("fs" 2 nil)]))
(defun lumina-get-ids ()
"Gets the ids of all songs in the sql result"
@ -36,7 +45,8 @@
(setf lumina-buffer (get-buffer-create "*lumina*"))
(with-current-buffer lumina-buffer
(lumina-mode)
(setf tabulated-list-entries (cl-mapcar #'list (lumina-get-ids) (lumina-get-songs)))
(setf tabulated-list-entries
(cl-mapcar #'list (lumina-get-ids) (lumina-get-songs)))
(tabulated-list-print t t))
(switch-to-buffer lumina-buffer))
@ -109,29 +119,44 @@
(search-forward "#+VERSE_ORDER: ")
(buffer-substring-no-properties (point) nil)))
(defvar lumina-lyrics-update-query (concat "update songs set lyrics = \"?" (lumina-grab-lyrics) "\" where title = " lumina-current-song))
(defvar lumina-lyrics-update-query
(concat "update songs set lyrics = \"?"
(lumina-grab-lyrics)
"\" where title = "
lumina-current-song))
(defun lumina-update-lyrics ()
"Update the lyrics in the db"
(interactive)
(sqlite-execute lumina-db "update songs set lyrics = ? where title = ?" `(,(lumina-grab-lyrics) ,lumina-current-song))
(sqlite-execute lumina-db
"update songs set lyrics = ? where title = ?"
`(,(lumina-grab-lyrics) ,lumina-current-song))
(setf lumina-songs (sqlite-select lumina-db "select * from songs;")))
(defun lumina-get-lyrics-genius (song)
"retrieve lyrics to a song from genius lyrics"
(let* ((url (concat "https://api.genius.com/search?" "access_token=" "R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx" "&q=" song))
(let* ((url (concat "https://api.genius.com/search?"
"access_token="
"R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx"
"&q="
song))
(songs
(cl-loop for song across
(cdr (cadadr (plz 'get (url-encode-url url) :as #'json-read)))
collect `(,(concat (cdr (elt (elt song 3) 19)) " by "
(cdr (elt (elt (elt song 3) 23) 7))
" with id "
(number-to-string
(cdr (elt (elt song 3) 7)))))))
(cdr (cadadr
(plz 'get (url-encode-url url) :as #'json-read)))
collect `(,(concat
(cdr (elt (elt song 3) 19)) " by "
(cdr (elt (elt (elt song 3) 23) 7))
" with id "
(number-to-string
(cdr (elt (elt song 3) 7)))))))
(selected-song (completing-read "song? " songs))
(id (replace-regexp-in-string "[^0-9]" "" selected-song)))
(plz 'get (url-encode-url (concat "https://api.genius.com/songs/" id "?access_token=R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx")))))
(plz 'get
(url-encode-url
(concat "https://api.genius.com/songs/" id
"?access_token=R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx")))))
(cdr (elt (elt (elt (lumina-get-lyrics-genius "Death Was Arrested") 0) 3) 7))