Add icon selection function

master
trémeur 3 years ago
parent e56299d08c
commit 0218f7d95c

@ -28,43 +28,75 @@
(with-current-buffer oldname (with-current-buffer oldname
(delete-file newname))) (delete-file newname)))
(defun dwpost (psubject tags icon location) (defun dwsecurity ()
(interactive (list (read-string "Post title (REQUIRED): ")
(read-string "Tags (comma-separated): ")
(read-string "Icon: ")
(read-string "Location: " "🏠")))
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private"))) (setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
(if (not security) (if (not security)
(setq security "xpublicx")) (setq security "skip"))
(if (equal security "skip")
(sleep-for 0)
(insert (concat "post-security: "
(let* ((securityjunk
(format "%S" security))
(end (- (length securityjunk) 2)))
(substring securityjunk 2 end))"\n"))))
(defun dwmood ()
(setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried"))) (setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried")))
(if (not mood) (if (not mood)
(setq mood "xnonex")) (setq mood "skip"))
(dwexport) (if (equal mood "skip")
(kill-buffer newname) (sleep-for 0)
(compose-mail "tobli+0397@post.dreamwidth.org" psubject) (insert (concat "post-mood: "
(with-current-buffer "*unsent mail to tobli*" (let* ((moodjunk
(insert (concat "post-tags: org-export, "tags "\n\n")) (format "%S" mood))
(insert (concat "post-security: " (end (- (length moodjunk) 2)))
(let* ((stringjunk (substring moodjunk 2 end))"\n"))))
(format "%S" security))
(end (- (length stringjunk) 2))) (defun dwmusic ()
(substring stringjunk 2 end))"\n\n")) (setq music (lastfm-user-get-recent-tracks :user "litrovers" :from 1 :to 1))
(insert (concat "post-icon: "icon "\n\n")) (setq music (replace-regexp-in-string (regexp-quote "\" \"") " " (format "%S" music) nil 'literal))
(insert (concat "post-mood: " (sleep-for 1)
(let* ((moodjunk (if (not music)
(format "%S" mood)) (setq music "skip"))
(end (- (length moodjunk) 2))) (if (equal music "skip")
(substring moodjunk 2 end))"\n\n")) (sleep-for 0)
(insert (concat "post-location: "location "\n\n"))
(setq music (lastfm-user-get-recent-tracks :user "litrovers" :from 1 :to 1))
(setq music (replace-regexp-in-string (regexp-quote "\" \"") " " (format "%S" music) nil 'literal))
(insert (concat "post-music: " (insert (concat "post-music: "
(let* ((musicjunk (let* ((musicjunk
(format "%S" music)) (format "%S" music))
(end (- (length musicjunk) 4))) (end (- (length musicjunk) 4)))
(substring musicjunk 4 end))"\n\n")) (substring musicjunk 4 end))"\n"))))
(defun dwicon (thefile)
(setq icon "skip")
(with-current-buffer thefile
(cond
((string-match-p "\\bbraska\\b" (buffer-substring (point-min) (point-max))) (setq icon "braska"))
((string-match-p "\\bffx[^-]\\b" (buffer-substring (point-min) (point-max))) (setq icon "ffx"))
((string-match-p "\\bffx-2\\b" (buffer-substring (point-min) (point-max))) (setq icon "ffx-2"))
((string-match-p "\\belp\\b" (buffer-substring (point-min) (point-max))) (setq icon "elp"))
((string-match-p "\\bprog\\b" (buffer-substring (point-min) (point-max))) (setq icon "prog"))
((string-match-p "\\btarkus\\b" (buffer-substring (point-min) (point-max))) (setq icon "tarkus"))))
(if (equal icon "skip")
(sleep-for 0)
(insert (concat "post-icon: "icon "\n"))))
(defun dwpost (psubject tags location)
(interactive (list (read-string "Post title (REQUIRED): ")
(read-string "Tags (comma-separated): ")
(read-string "Location: " "🏠")))
(dwexport)
(compose-mail "tobli+0397@post.dreamwidth.org" psubject)
(with-current-buffer "*unsent mail to tobli*"
(insert (concat "post-tags: org-export, "tags "\n"))
(insert (concat "post-location: "location "\n"))
(dwsecurity)
(dwicon newname)
(dwmood)
(dwmusic)
(insert (concat "\n"))
(insert-file-contents newname) (insert-file-contents newname)
(message-send-and-exit)) (message-send-and-exit))
(kill-buffer newname)
(kill-buffer "*sent mail to tobli*") (kill-buffer "*sent mail to tobli*")
(with-current-buffer oldname (with-current-buffer oldname
(delete-file newname))) (delete-file newname)))

@ -189,7 +189,10 @@
(setq calibredb-root-dir "~/Documents/drive/calibre/ebooks") (setq calibredb-root-dir "~/Documents/drive/calibre/ebooks")
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir)) (setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
(setq calibredb-library-alist '(("~/Documents/drive/calibre/ebooks") (setq calibredb-library-alist '(("~/Documents/drive/calibre/ebooks")
("~/Documents/drive/calibre/ffff")))) ("~/Documents/drive/calibre/ffff")
("~/Documents/drive/calibre/ovely")))
(setq calibredb-sort-by 'author)
(setq calibredb-order 'asc))
(use-package nov (use-package nov
:init :init
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))

Loading…
Cancel
Save