fordon_greeman / voidfiles

Branch: 2079ec5
Switch branches/tags
main
theidioticdev add emacs 2079ec5 21h ago
55 lines · 1.7 KB Raw Blame History
1 ;;; emms-idapi.el --- EMMS Music ID API support -*- lexical-binding: t; -*-
2 ;;
3
4 ;; Copyright (C) 2024 Free Software Foundation, Inc.
5
6 ;; Author: Yoni Rabkin <yrk@gnu.org>
7
8 ;; This file is part of EMMS.
9
10 ;; EMMS is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; any later version.
14
15 ;; EMMS is distributed in the hope that it will be useful, but WITHOUT
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 ;; License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with EMMS; see the file COPYING. If not, write to the Free
22 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 ;; MA 02110-1301, USA.
24
25
26 ;;; Commentary:
27 ;;
28
29 ;;; Code:
30 (require 'emms-idapi-musicbrainz)
31
32
33 (defvar emms-idapi-services-alist
34 '((musicbrainz . ((search-f . emms-idapi-musicbrainz-search)
35 (name . "MusicBrainz")
36 (website . "https://musicbrainz.org/"))))
37 "Association list of services supported by IDAPI.")
38
39 (defvar emms-idapi-service nil
40 "The music search service currently in use.")
41
42
43 (defun emms-idapi-search (service search-term-alist)
44 "Search against SERVICE for SEARCH-TERM-ALIST."
45 (let ((search-function (alist-get 'search-f
46 (alist-get service
47 emms-idapi-services-alist))))
48 (if (not search-function)
49 (error "`%s' is an unsupported service." service))
50 (funcall search-function search-term-alist)))
51
52
53 (provide 'emms-idapi)
54
55 ;;; emms-idapi.el ends here