1 /*
2 * cddbkey1 - CDDB Interface Library for xmcd/cda
3 *
4 * This library implements an interface to access the "classic"
5 * CDDB1 services.
6 *
7 * Copyright (C) 1993-2004 Ti Kan
8 * E-mail: xmcd@amb.org
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25 #ifndef lint
26 static char *_cddbkey1_c_ident_ = "@(#)cddbkey1.c 7.26 03/12/12";
27 #endif
28
29 #define XMCD_CDDB /* Enable the correct include file in CDDB2API.h */
30
31 #include "common_d/appenv.h"
32 #include "common_d/version.h"
33 #include "common_d/util.h"
34 #include "libdi_d/libdi.h"
35 #include "cdinfo_d/cdinfo.h"
36 #include "cddb_d/CDDB2API.h"
37
38
39 /*
40 * cddb_ifver
41 * Return the CDDB interface version number
42 *
43 * Args:
44 * None.
45 *
46 * Return:
47 * The CDDB interface version (1 = CDDB1, 2 = CDDB2)
48 */
49 int
cddb_ifver(void)50 cddb_ifver(void)
51 {
52 return 1;
53 }
54
55
56 /*
57 * cddb_setkey
58 * Register the client information with the CDDB library
59 *
60 * Args:
61 * cp - CDDB pointer from cdinfo_opencddb()
62 * clp - cdinfo client info structure pointer
63 * adp - Pointer to the app_data structure
64 * s - Pointer to the curstat_t structure
65 * errfp - FILE stream to debugging output
66 *
67 * Return:
68 * TRUE - success
69 * FALSE - failure
70 */
71 /*ARGSUSED*/
72 bool_t
cddb_setkey(cdinfo_cddb_t * cp,cdinfo_client_t * clp,appdata_t * adp,curstat_t * s,FILE * errfp)73 cddb_setkey(
74 cdinfo_cddb_t *cp,
75 cdinfo_client_t *clp,
76 appdata_t *adp,
77 curstat_t *s,
78 FILE *errfp
79 )
80 {
81 CddbResult ret;
82
83 if (adp->debug & DBG_CDI)
84 (void) fprintf(errfp, "CddbControl_SetClientInfo: ");
85 ret = CddbControl_SetClientInfo(
86 cp->ctrlp, XMCD_CLIENT_ID,
87 (adp->debug & DBG_CDI) ? "debug" : "",
88 VERSION_MAJ "." VERSION_MIN, clp->prog
89 );
90 if (adp->debug & DBG_CDI)
91 (void) fprintf(errfp, "0x%lx\n", ret);
92
93 return (ret == Cddb_OK || ret == Cddb_FALSE);
94 }
95
96
97