[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/emms 3500f1c 8/8: Merge branch 'opus-tags'
From: |
ELPA Syncer |
Subject: |
[elpa] externals/emms 3500f1c 8/8: Merge branch 'opus-tags' |
Date: |
Sat, 5 Jun 2021 00:57:16 -0400 (EDT) |
branch: externals/emms
commit 3500f1c12e0b9ca8a79686780c36f7df0c80ffb3
Merge: 06ef243 1a28476
Author: Grant Shangreaux <grant@unabridgedsoftware.com>
Commit: Grant Shangreaux <grant@unabridgedsoftware.com>
Merge branch 'opus-tags'
---
emms-info-libtag.el | 2 +-
emms-setup.el | 1 +
emms-tag-editor.el | 5 +++-
emms-tag-tracktag.el | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/emms-info-libtag.el b/emms-info-libtag.el
index fb9c5dd..9425a38 100644
--- a/emms-info-libtag.el
+++ b/emms-info-libtag.el
@@ -74,7 +74,7 @@
:type '(string))
(defcustom emms-info-libtag-known-extensions
- (regexp-opt '("mp3" "mp4" "m4a" "ogg" "flac" "spx" "wma"))
+ (regexp-opt '("mp3" "mp4" "m4a" "ogg" "flac" "spx" "wma" "opus"))
"Regexp of known extensions compatible with `emms-info-libtag-program-name'.
Case is irrelevant."
diff --git a/emms-setup.el b/emms-setup.el
index d086878..5fd3267 100644
--- a/emms-setup.el
+++ b/emms-setup.el
@@ -90,6 +90,7 @@ the stable features which come with the Emms distribution."
(require 'emms-mode-line)
(require 'emms-mark)
(require 'emms-tag-editor)
+ (require 'emms-tag-tracktag)
(require 'emms-show-all)
(require 'emms-streams)
(require 'emms-lyrics)
diff --git a/emms-tag-editor.el b/emms-tag-editor.el
index 5b6e447..0ea887d 100644
--- a/emms-tag-editor.el
+++ b/emms-tag-editor.el
@@ -37,6 +37,7 @@
(require 'emms-info-mp3info)
(require 'emms-playlist-mode)
(require 'emms-mark)
+(require 'emms-tag-tracktag)
(require 'format-spec)
(require 'subr-x)
@@ -85,6 +86,7 @@
`(("mp3" . ,default)
("ogg" . ,(emms-tag-editor-make-format (remove 'info-year tags)))
("flac" . ,(emms-tag-editor-make-format (remove 'info-year tags)))
+ ("opus" . ,(emms-tag-editor-make-format (remove 'info-genre tags)))
("default" . ,default)))
"Format to use when inserting the track.
The CAR part is the extension of the track name, and the CDR part
@@ -138,7 +140,8 @@ See also `emms-tag-editor-default-parser'.")
(info-performer . "--TOPE")
(info-date . "--TDAT")))
("ogg" . emms-tag-editor-tag-ogg)
- ("flac" . emms-tag-editor-tag-flac))
+ ("flac" . emms-tag-editor-tag-flac)
+ ("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-tag-tracktag.el b/emms-tag-tracktag.el
new file mode 100644
index 0000000..3be8e6c
--- /dev/null
+++ b/emms-tag-tracktag.el
@@ -0,0 +1,77 @@
+;;; emms-tag-tracktag.el --- EMMS interface for audiotools tracktag -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Grant Shoshin Shangreaux <grant@churls.world>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Provides a wrapper for audiotools tracktag executable
+;; http://audiotools.sourceforge.net/tracktag.html
+;; Given an EMMS TRACK structure, it will map the emms-info fields onto
+;; arguments for tracktag. Then it calls the tracktag process to write the
+;; info as metadata tags on the track's associated file.
+
+;;; Code:
+
+(require 'emms)
+
+(defvar emms-tag-tracktag--info-fields
+ '((info-artist . artist)
+ (info-composer . composer)
+ (info-performer . performer)
+ (info-title . name)
+ (info-album . album)
+ (info-tracknumber . number)
+ (info-discnumber . album-number)
+ (info-year . year)
+ (info-date . date)
+ (info-note . comment))
+ "An alist mapping info-* fields to tracktag fields.")
+
+(defvar emms-tag-tracktag-log-buffer "*EMMS-LOG*"
+ "Name of emms-tag-tractack's log buffer.
+Defaults to the same value as emms-tag-editor-log-buffer")
+
+(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-tag-tracktag--info-fields)))
+
+(defun emms-tag-tracktag--build-args (track)
+ (flatten-list
+ (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-tag-tracktag-file (track)
+ (apply #'call-process
+ "tracktag" nil
+ (get-buffer-create emms-tag-tracktag-log-buffer)
+ nil
+ "-Vdebug"
+ (emms-tag-tracktag--build-args track)))
+
+(provide 'emms-tag-tracktag)
+;;; emms-tag-tracktag.el ends here
- [elpa] externals/emms updated (06ef243 -> 3500f1c), ELPA Syncer, 2021/06/05
- [elpa] externals/emms c803159 1/8: Add: emms-tracktag wrapper for the audiotools program, ELPA Syncer, 2021/06/05
- [elpa] externals/emms 7dc6885 3/8: Add: re-namespace emms-tag-tracktag, info-date map to date, ELPA Syncer, 2021/06/05
- [elpa] externals/emms e5b53f6 4/8: Fix: circular dependency adding log buffer var for tracktag, ELPA Syncer, 2021/06/05
- [elpa] externals/emms 265b3bb 6/8: * emms-tag-tracktag.el: fix copyright, ELPA Syncer, 2021/06/05
- [elpa] externals/emms 3500f1c 8/8: Merge branch 'opus-tags',
ELPA Syncer <=
- [elpa] externals/emms fba4599 2/8: Remove test files for now, ELPA Syncer, 2021/06/05
- [elpa] externals/emms 1a28476 7/8: * emms-tag-editor.el: Add: opus config for tag editor format, ELPA Syncer, 2021/06/05
- [elpa] externals/emms 7465249 5/8: * emms-setup.el: add tracktag to emms-all, ELPA Syncer, 2021/06/05