aboutsummaryrefslogtreecommitdiff
path: root/audio/tcd
diff options
context:
space:
mode:
authorPietro Cerutti <gahr@FreeBSD.org>2008-06-26 18:37:56 +0000
committerPietro Cerutti <gahr@FreeBSD.org>2008-06-26 18:37:56 +0000
commit3fb5d3b04855705bbb7c171fb19128b2bdbc892b (patch)
tree6269ed85edfeaa78888ac93a716b8982faf1ac5c /audio/tcd
parent3f7459dbcce09aca6adf50b227e9af5dabb50701 (diff)
downloadports-3fb5d3b04855705bbb7c171fb19128b2bdbc892b.tar.gz
ports-3fb5d3b04855705bbb7c171fb19128b2bdbc892b.zip
Notes
Diffstat (limited to 'audio/tcd')
-rw-r--r--audio/tcd/Makefile38
-rw-r--r--audio/tcd/distinfo3
-rw-r--r--audio/tcd/files/patch-cddb.c33
-rw-r--r--audio/tcd/files/patch-cddb.h11
-rw-r--r--audio/tcd/files/patch-tcd.c20
-rw-r--r--audio/tcd/files/patch-tcd_mb.c99
-rw-r--r--audio/tcd/files/patch-tcd_mb.h47
-rw-r--r--audio/tcd/pkg-descr3
8 files changed, 254 insertions, 0 deletions
diff --git a/audio/tcd/Makefile b/audio/tcd/Makefile
new file mode 100644
index 000000000000..c89d48409dad
--- /dev/null
+++ b/audio/tcd/Makefile
@@ -0,0 +1,38 @@
+# New ports collection Makefile for: tcd
+# Date created: 20 June 2008
+# Whom: gahr
+#
+# $FreeBSD$
+#
+
+PORTNAME= tcd
+PORTVERSION= 2.2.0
+CATEGORIES= audio
+MASTER_SITES= ${MASTER_SITE_SAVANNAH}
+MASTER_SITE_SUBDIR= ${PORTNAME}
+
+MAINTAINER= gahr@FreeBSD.org
+COMMENT= A simple, user-friendly ncurses-based CD player
+
+OPTIONS= MUSICBRAINZ "Enable experimental MusicBrainz support" OFF
+
+USE_SDL= sdl
+GNU_CONFIGURE= yes
+
+MAN1= tcd.1
+PLIST_FILES= bin/tcd
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_MUSICBRAINZ)
+LIB_DEPENDS= musicbrainz.4:${PORTSDIR}/audio/libmusicbrainz
+CFLAGS+= -I${LOCALBASE}/include -L${LOCALBASE}/lib \
+ -DUSE_MUSICBRAINZ -lmusicbrainz -ggdb
+post-patch:
+ ${REINPLACE_CMD} -e 's|tcd_SOURCES = |tcd_SOURCES = tcd_mb.c tcd_mb.h |' \
+ ${WRKSRC}/src/Makefile.am ${WRKSRC}/src/Makefile.in
+ ${REINPLACE_CMD} -e 's|am_tcd_OBJECTS = |am_tcd_OBJECTS = tcd_mb.$$(OBJEXT) |' \
+ ${WRKSRC}/src/Makefile.in
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/audio/tcd/distinfo b/audio/tcd/distinfo
new file mode 100644
index 000000000000..c76c2ebf0571
--- /dev/null
+++ b/audio/tcd/distinfo
@@ -0,0 +1,3 @@
+MD5 (tcd-2.2.0.tar.gz) = bbaf147ced01f56b788d3944c9c2daf3
+SHA256 (tcd-2.2.0.tar.gz) = 8215195ced06c6f4acb7cee6517e66e48a0dfda8cc64f0cfbe7bd621072ab12d
+SIZE (tcd-2.2.0.tar.gz) = 113738
diff --git a/audio/tcd/files/patch-cddb.c b/audio/tcd/files/patch-cddb.c
new file mode 100644
index 000000000000..e7703852e8b7
--- /dev/null
+++ b/audio/tcd/files/patch-cddb.c
@@ -0,0 +1,33 @@
+--- src/cddb.c.orig 2004-06-15 23:20:09.000000000 +0200
++++ src/cddb.c 2008-06-26 20:15:03.000000000 +0200
+@@ -39,6 +39,9 @@
+
+ #include "cd-utils.h"
+ #include "cddb.h"
++#ifdef USE_MUSICBRAINZ
++# include "tcd_mb.h"
++#endif
+ #include "concat-strings.h"
+
+ static void append_data(char *dest, const char *data, size_t maxlen)
+@@ -229,12 +232,19 @@
+ return concat_strings(get_home_dir(), "/.tcd/", cd_id, NULL);
+ }
+
+-extern int tcd_readdiskinfo(struct cd_info *cd, SDL_CD * cdrom)
++extern int tcd_readdiskinfo(struct tcd_state *cds, SDL_CD * cdrom)
+ {
+ int result;
+ char *filename;
++ struct cd_info *cd = &cds->cd_info;
+
+ result = 0;
++
++#ifdef USE_MUSICBRAINZ
++ if (!tcd_readmb(cds, cdrom))
++ return result;
++#endif
++
+ if ((filename = cddb_filename(cddb_discid(cdrom))) != NULL) {
+ result = tcd_readcddb(cd, cdrom, filename);
+ free(filename);
diff --git a/audio/tcd/files/patch-cddb.h b/audio/tcd/files/patch-cddb.h
new file mode 100644
index 000000000000..461bcb139c36
--- /dev/null
+++ b/audio/tcd/files/patch-cddb.h
@@ -0,0 +1,11 @@
+--- src/cddb.h.orig 2004-06-15 22:13:19.000000000 +0200
++++ src/cddb.h 2008-06-26 20:13:57.000000000 +0200
+@@ -30,7 +30,7 @@
+
+ #include "tcd.h"
+
+-extern int tcd_readdiskinfo(struct cd_info *cd, SDL_CD *cdrom);
++extern int tcd_readdiskinfo(struct tcd_state *cd, SDL_CD *cdrom);
+ extern void tcd_writediskinfo(struct cd_info *cd, SDL_CD *cdrom);
+
+ #endif /* TCD_CDDB_H */
diff --git a/audio/tcd/files/patch-tcd.c b/audio/tcd/files/patch-tcd.c
new file mode 100644
index 000000000000..dc61a4e5750f
--- /dev/null
+++ b/audio/tcd/files/patch-tcd.c
@@ -0,0 +1,20 @@
+--- src/tcd.c.orig 2008-06-26 19:40:23.000000000 +0200
++++ src/tcd.c 2008-06-26 19:40:47.000000000 +0200
+@@ -221,7 +221,7 @@
+ if (state.cd_info.modified) {
+ tcd_writediskinfo(&state.cd_info, state.cdrom);
+ }
+- tcd_readdiskinfo(&state.cd_info, state.cdrom);
++ tcd_readdiskinfo(&state, state.cdrom);
+ state.current_discid = discid;
+ }
+ }
+@@ -237,7 +237,7 @@
+ state.play_method = NORMAL;
+
+ init_SDL((argc > 1) ? strtol(argv[1], NULL, 0) : 0);
+- tcd_readdiskinfo(&state.cd_info, state.cdrom);
++ tcd_readdiskinfo(&state, state.cdrom);
+ tcd_ui_init();
+ tcd_ui_update(&state);
+ state.current_discid = cddb_discid(state.cdrom);
diff --git a/audio/tcd/files/patch-tcd_mb.c b/audio/tcd/files/patch-tcd_mb.c
new file mode 100644
index 000000000000..4fcbe569420f
--- /dev/null
+++ b/audio/tcd/files/patch-tcd_mb.c
@@ -0,0 +1,99 @@
+--- /dev/null 2008-06-26 20:30:06.000000000 +0200
++++ src/tcd_mb.c 2008-06-26 20:31:36.000000000 +0200
+@@ -0,0 +1,96 @@
++/*-
++ * Copyright (c) 2008 Pietro Cerutti <gahr@FreeBSD.ch>
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#include "tcd_mb.h"
++#include <musicbrainz/mb_c.h>
++
++int
++tcd_readmb(struct tcd_state *cd, SDL_CD *cdrom)
++{
++ int nof_cds; /* Can handle only one at the moment */
++ char *cd_title;
++ static char tmp_buff[256] = { 0 };
++ size_t len;
++ musicbrainz_t mb;
++
++ /*
++ * Sanity check
++ */
++ if(!cd || !cdrom)
++ return (1);
++
++ /*
++ * Initialize
++ */
++ cd_title = cd->cd_info.disc_title;
++ mb = mb_New();
++ mb_SetServer(mb, MB_HOST, MB_PORT);
++ mb_SetDevice(mb, SDL_CDName(cd->current_discid));
++ if (!mb_Query(mb, MBQ_GetCDInfo)) {
++ mb_GetQueryError(mb, tmp_buff, sizeof(tmp_buff));
++ fprintf(stderr, "MusicBrainz error: %s\n", tmp_buff);
++ return (1);
++ }
++
++ /*
++ * Query
++ */
++ nof_cds = mb_GetResultInt(mb, MBE_GetNumAlbums);
++ if(nof_cds != 1) {
++ fprintf(stderr, "MusicBrainz error: %sCD%s found\n",
++ !nof_cds ? "no" : "too many", !nof_cds ? "" : "s");
++ return (1);
++ }
++
++ /*
++ * Select
++ */
++ mb_Select1(mb, MBS_SelectArtist, 1);
++ mb_Select1(mb, MBS_SelectAlbum, 1);
++
++ /*
++ * Set Artist and Album
++ */
++ mb_GetResultData(mb, MBE_AlbumGetAlbumArtistName, tmp_buff, sizeof(tmp_buff));
++ len = snprintf(cd_title, 256, "%s / ", tmp_buff);
++ mb_GetResultData(mb, MBE_AlbumGetAlbumName, cd_title+len, 256 - len);
++
++ /*
++ * Set tracks
++ */
++ for(len = 1; len <= cdrom->numtracks; len++)
++ mb_GetResultData1(mb, MBE_AlbumGetTrackName, cd->cd_info.trk[len-1].name, 256, len);
++
++ mb_Delete(mb);
++
++ return (0);
++}
diff --git a/audio/tcd/files/patch-tcd_mb.h b/audio/tcd/files/patch-tcd_mb.h
new file mode 100644
index 000000000000..1e9aa881929c
--- /dev/null
+++ b/audio/tcd/files/patch-tcd_mb.h
@@ -0,0 +1,47 @@
+--- /dev/null 2008-06-26 20:11:00.000000000 +0200
++++ src/tcd_mb.h 2008-06-26 19:37:19.000000000 +0200
+@@ -0,0 +1,44 @@
++/*-
++ * Copyright (c) 2008 Pietro Cerutti <gahr@FreeBSD.ch>
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#ifndef TCD_MB_H_
++#define TCD_MB_H_
++
++#include "tcd.h"
++#include <SDL/SDL.h>
++
++#define MB_HOST "www.musicbrainz.org"
++#define MB_PORT 80
++
++int tcd_readmb(struct tcd_state *cd, SDL_CD *cdrom);
++
++#endif /* ! TCD_MB_H_ */
diff --git a/audio/tcd/pkg-descr b/audio/tcd/pkg-descr
new file mode 100644
index 000000000000..0ad3414ffc24
--- /dev/null
+++ b/audio/tcd/pkg-descr
@@ -0,0 +1,3 @@
+TCD - a tiny CD player - is a simple, user-friendly ncurses-based CD player.
+
+WWW: http://www.nongnu.org/tcd/