Add functions for tracking music (performances and scrobbles)

master
trémeur 12 months ago
parent 5b16cd2480
commit d451b56eeb

@ -18,12 +18,12 @@
"Find or create heading for acquired books" "Find or create heading for acquired books"
(filedate) (filedate)
(goto-char (point-min)) (goto-char (point-min))
(if (not (search-forward "** acquired" nil t)) (if (not (search-forward "** obtained" nil t))
(if (not (search-forward "* books" nil t)) (if (not (search-forward "* books" nil t))
(progn (progn
(goto-char (point-max)) (goto-char (point-max))
(insert "* books\n** acquired")) (insert "* books\n** obtained"))
(insert "\n** acquired")))) (insert "\n** obtained"))))
(defun findwatched () (defun findwatched ()
"Find or create heading for watched films" "Find or create heading for watched films"
@ -82,6 +82,26 @@
(setq visitreturn (concat " <" visitstart ">--<" visitend ">"))) (setq visitreturn (concat " <" visitstart ">--<" visitend ">")))
visitreturn) visitreturn)
(defun findperf ()
"Find or create heading for performances"
(filedate)
(goto-char (point-min))
(if (not (search-forward "* performances" nil t))
(progn
(goto-char (point-max))
(insert "* performances"))))
(defun setensemble ()
"Get the ensemble performed with"
(setq ensembles (s-split "\n" (f-read "~/Documents/drive/admin/emacs/ensembles.txt") t))
(setq theensemble (completing-read "Ensemble: " ensembles))
theensemble)
(defun setvenue ()
(setq venues (s-split "\n" (f-read "~/Documents/drive/admin/emacs/venues.txt") t))
(setq thevenue (completing-read "Venue: " venues))
thevenue)
(setq org-default-notes-file (concat "~/Documents/drive/org/journal/" (format-time-string "%Y/%m/%Y-%m-%d") ".org")) (setq org-default-notes-file (concat "~/Documents/drive/org/journal/" (format-time-string "%Y/%m/%Y-%m-%d") ".org"))
(setq org-capture-templates (setq org-capture-templates
@ -101,6 +121,10 @@
(file+function "" findwatched) (file+function "" findwatched)
"* %^{Title} (%^{Year})%(therating)" "* %^{Title} (%^{Year})%(therating)"
:jump-to-captured t) :jump-to-captured t)
("m" "Musical performance" entry
(file+function "" findperf)
"* %(setensemble)\n** %^{Performance name} (%(setvenue))\n%?"
:jump-to-captured t)
("p" "Visited place" entry ("p" "Visited place" entry
(file+function "" findvisited) (file+function "" findvisited)
"* %^{Place}%(thevisitdate)" "* %^{Place}%(thevisitdate)"

@ -1,3 +1,14 @@
(defun filedate ()
"Insert timestamp if required based on file name"
(interactive)
(goto-char (point-min))
(unless (eq ?< (char-after))
(setq thedate (file-name-base))
(insert (concat "<" thedate ">"))
(org-ctrl-c-ctrl-c)
(insert "\n\n")
(goto-char (point-min))))
(defun filejournal () (defun filejournal ()
"Refile heading to specific file based on heading (journal edition)" "Refile heading to specific file based on heading (journal edition)"
(interactive) (interactive)
@ -5,9 +16,13 @@
(setq orgyear (substring orgheading 0 4)) (setq orgyear (substring orgheading 0 4))
(setq orgmonth (substring orgheading 5 7)) (setq orgmonth (substring orgheading 5 7))
(setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org")) (setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org"))
(setq orgbuffername (concat orgheading ".org"))
(org-edit-headline "journal") (org-edit-headline "journal")
(let ((org-refile-targets '((orgfilepath :maxlevel . 1)))) (let ((org-refile-targets '((orgfilepath :maxlevel . 1))))
(org-refile))) (org-refile))
(with-current-buffer orgbuffername
(filedate)
(write-file orgbuffername)))
(defun filediscord () (defun filediscord ()
"Refile heading to specific file based on heading (discord edition)" "Refile heading to specific file based on heading (discord edition)"
@ -16,9 +31,13 @@
(setq orgyear (substring orgheading 0 4)) (setq orgyear (substring orgheading 0 4))
(setq orgmonth (substring orgheading 5 7)) (setq orgmonth (substring orgheading 5 7))
(setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org")) (setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org"))
(setq orgbuffername (concat orgheading ".org"))
(org-edit-headline "discord") (org-edit-headline "discord")
(let ((org-refile-targets '((orgfilepath :maxlevel . 1)))) (let ((org-refile-targets '((orgfilepath :maxlevel . 1))))
(org-refile))) (org-refile))
(with-current-buffer orgbuffername
(filedate)
(write-file orgbuffername)))
(defun filemusic () (defun filemusic ()
"Refile heading to specific file based on heading (music edition)" "Refile heading to specific file based on heading (music edition)"
@ -27,17 +46,10 @@
(setq orgyear (substring orgheading 0 4)) (setq orgyear (substring orgheading 0 4))
(setq orgmonth (substring orgheading 5 7)) (setq orgmonth (substring orgheading 5 7))
(setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org")) (setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org"))
(setq orgbuffername (concat orgheading ".org"))
(org-edit-headline "music") (org-edit-headline "music")
(let ((org-refile-targets '((orgfilepath :maxlevel . 1)))) (let ((org-refile-targets '((orgfilepath :maxlevel . 1))))
(org-refile))) (org-refile))
(with-current-buffer orgbuffername
(defun filedate () (filedate)
"Insert timestamp if required based on file name" (write-file orgbuffername)))
(interactive)
(goto-char (point-min))
(unless (eq ?< (char-after))
(setq thedate (file-name-base))
(insert (concat "<" thedate ">"))
(org-ctrl-c-ctrl-c)
(insert "\n\n")
(goto-char (point-min))))

Loading…
Cancel
Save