aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emms-tag-editor.el4
-rw-r--r--emms-tag-tracktag.el (renamed from emms-tracktag.el)46
2 files changed, 26 insertions, 24 deletions
diff --git a/emms-tag-editor.el b/emms-tag-editor.el
index 45c90f7..ce9d934 100644
--- a/emms-tag-editor.el
+++ b/emms-tag-editor.el
@@ -37,7 +37,7 @@
(require 'emms-info-mp3info)
(require 'emms-playlist-mode)
(require 'emms-mark)
-(require 'emms-tracktag)
+(require 'emms-tag-tracktag)
(require 'format-spec)
(require 'subr-x)
@@ -140,7 +140,7 @@ See also `emms-tag-editor-default-parser'.")
(info-date . "--TDAT")))
("ogg" . emms-tag-editor-tag-ogg)
("flac" . emms-tag-editor-tag-flac)
- ("opus" . emms-tracktag-file))
+ ("opus" . emms-tag-tracktag-file))
"An alist used when committing changes to tags in files.
If the external program sets tags by command line options
one-by-one, then the list should like:
diff --git a/emms-tracktag.el b/emms-tag-tracktag.el
index 0b8b660..71c6ff5 100644
--- a/emms-tracktag.el
+++ b/emms-tag-tracktag.el
@@ -1,4 +1,4 @@
-;;; emms-tracktag.el --- EMMS interface for audiotools tracktag -*- lexical-binding: t; -*-
+;;; emms-tag-tracktag.el --- EMMS interface for audiotools tracktag -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Grant Shoshin Shangreaux
@@ -30,42 +30,44 @@
(require 'emms)
-(defvar emms-info-tracktag--info-fields
- '((info-album . album)
- (info-artist . artist)
+(defvar emms-tag-tracktag--info-fields
+ '((info-artist . artist)
(info-composer . composer)
(info-performer . performer)
- (info-year . year)
- (info-date . year)
+ (info-title . name)
+ (info-album . album)
(info-tracknumber . number)
(info-discnumber . album-number)
- (info-note . comment)
- (info-title . name))
+ (info-year . year)
+ (info-date . date)
+ (info-note . comment))
"An alist mapping info-* fields to tracktag fields.")
-(defun emms-tracktag--map-track-info (track)
+(defun emms-tag-tracktag--map-track-info (track)
(seq-filter (lambda (cell) (cdr cell))
(mapcar (lambda (pair)
(cons (cdr pair) (emms-track-get track (car pair))))
- emms-info-tracktag--info-fields)))
+ emms-tag-tracktag--info-fields)))
-(defun emms-tracktag--build-args (track)
+(defun emms-tag-tracktag--build-args (track)
(flatten-list
- (append (mapcar (lambda (pair)
- (let ((tag (car pair)) (value (cdr pair)))
- (when value
- (if (string-equal value "") (concat "--remove-" (format "%s" tag))
- (concat "--" (format "%s" tag) "=" value)))))
- (emms-tracktag--map-track-info track))
- (list (emms-track-name track)))))
+ (append
+ (mapcar (lambda (pair)
+ (let ((tag (car pair)) (value (cdr pair)))
+ (when value
+ ;; if we've deleted a tag value in the editor, remove the tag from file metadata.
+ (if (string-equal "" value) (concat "--remove-" (format "%s" tag))
+ (concat "--" (format "%s" tag) "=" value)))))
+ (emms-tag-tracktag--map-track-info track))
+ (list (emms-track-name track)))))
-(defun emms-tracktag-file (track)
+(defun emms-tag-tracktag-file (track)
(apply #'call-process
"tracktag" nil
(get-buffer-create emms-tag-editor-log-buffer)
nil
"-Vdebug"
- (emms-tracktag--build-args track)))
+ (emms-tag-tracktag--build-args track)))
-(provide 'emms-tracktag)
-;;; emms-tracktag.el ends here
+(provide 'emms-tag-tracktag)
+;;; emms-tag-tracktag.el ends here