diff -urN mcd-0.3a/Makefile mcd-0.3b/Makefile --- mcd-0.3a/Makefile Fri Jul 27 02:59:39 2001 +++ mcd-0.3b/Makefile Sat Jul 28 01:33:22 2001 @@ -16,7 +16,7 @@ OBJS = $(SRC:.c=.o) PRGS = mcd -all: clean $(PRGS) +all: $(PRGS) mcd: $(OBJS) strip -x $(S_FLAGS) $(OBJS) @@ -27,9 +27,8 @@ rm -rf $(OBJS) mcd install: - cp mcd $(BINDIR) - cp mcd.1 $(MANDIR)/man1 - gzip $(MANDIR)/man1/mcd.1 + cp -f mcd $(BINDIR) + cp -f mcd.1 $(MANDIR)/man1 && gzip -f9 $(MANDIR)/man1/mcd.1 .c.o: $(CC) $(CFLAGS) -c $< -o $@ diff -urN mcd-0.3a/cddb.c mcd-0.3b/cddb.c --- mcd-0.3a/cddb.c Fri Jul 27 08:05:34 2001 +++ mcd-0.3b/cddb.c Sat Jul 28 01:30:40 2001 @@ -7,7 +7,7 @@ #include "mcd.h" #include -#define BUFSIZE 1024 /* complete lines must fit ! */ +#define BUFSIZE 1024 /* complete lines of server must fit ! */ char port[6], ip[16]; static short cddb_parseentry(struct mcd *cd); @@ -178,5 +178,32 @@ close(h.fd); free(h.msg); - return CDDB_REMOTE; + if (!cddb_parseentry(&cd[0])) + return CDDB_REMOTE; + return CDDB_NOENT; } + +/* +TODO: + +201 whisky.wu-wien.ac.at CDDBP server v1.4b42PL0 ready at Sat Jul 28 01:08:01 2001 + +cddb hello mcmilk darkwood mcd 0.3b +200 Hello and welcome mcmilk@darkwood running mcd 0.3b. + +cddb query 8910cf1c 28 182 11982 26962 40150 54342 65580 76077 85992 95200 108477 123820 135037 145632 157072 167537 +187660 199132 206732 218450 228770 240150 248750 260525 268050 275925 287920 305385 311842 4305 +211 Found inexact matches, list follows (until terminating `.') + +rock 7510961c Böhse Onkelz / Der Nette Mann + Demos + +rock 9f10d71c Böhse Onkelz / Der nette Mann & Demos + +rock 9711051c Böhse Onkelz / Der nette Mann + +. + +... + +quit +*/ diff -urN mcd-0.3a/cddev.c mcd-0.3b/cddev.c --- mcd-0.3a/cddev.c Fri Jul 27 08:01:52 2001 +++ mcd-0.3b/cddev.c Sat Jul 28 01:30:39 2001 @@ -9,10 +9,9 @@ static void cd_playmsf(struct mcd *cd, struct cdrom_msf *msf); static void cd_playmsf(struct mcd *cd, struct cdrom_msf *msf) { - if (cd->status == CDROM_AUDIO_PLAY) { + if (cd->status == CDROM_AUDIO_PLAY) if (ioctl(cd->fd,CDROMPAUSE,NULL)<0) - draw_status("error stopping",1); - } + return; if (ioctl(cd->fd,CDROMPLAYMSF, msf)<0) draw_status("error playing",1); return; @@ -59,10 +58,9 @@ for (i=1;i<=cdth.cdth_trk1 && i<=MCD_CDAUDIO_MAX;i++) { cd->cdte[i].cdte_track=i; cd->cdte[i].cdte_format=CDROM_MSF; - if (ioctl(cd->fd, CDROMREADTOCENTRY, &cd->cdte[i])<0) { - draw_status("can't read disc",1); + if (ioctl(cd->fd, CDROMREADTOCENTRY, &cd->cdte[i])<0) return -1; - } else { + else { cd->t[i].audio=cd->cdte[i].cdte_ctrl & CDROM_DATA_TRACK; cd->t[i].min=cd->cdte[i].cdte_addr.msf.minute; cd->t[i].sec=cd->cdte[i].cdte_addr.msf.second; @@ -79,10 +77,9 @@ /* now the leadout for track[0] + track[last] */ cd->cdte[0].cdte_track=CDROM_LEADOUT; cd->cdte[0].cdte_format=CDROM_MSF; - if (ioctl(cd->fd, CDROMREADTOCENTRY, &cd->cdte[0])<0) { - draw_status("can't read disc",1); + if (ioctl(cd->fd, CDROMREADTOCENTRY, &cd->cdte[0])<0) return -1; - } else { + else { cd->t[0].audio=cd->cdte[0].cdte_ctrl & CDROM_DATA_TRACK; cd->t[0].min=cd->cdte[0].cdte_addr.msf.minute; cd->t[0].sec=cd->cdte[0].cdte_addr.msf.second; @@ -114,10 +111,6 @@ /* audiostatus changed */ if (cd->cds.cdsc_audiostatus!=cd->status) { /* also NO_[DISC|INFO] */ cd->status=cd->cds.cdsc_audiostatus; - if (cd->status==CDS_NO_DISC) { - updates[U_NODISC]=updates[U_ALL]=1; - return -1; - } /* intro */ if (cd->method==M_INTRO && cd->status==CDROM_AUDIO_COMPLETED) { cd->title[0]++; updates[U_TRACKS]=1; diff -urN mcd-0.3a/doc/CHANGES mcd-0.3b/doc/CHANGES --- mcd-0.3a/doc/CHANGES Fri Jul 27 08:10:12 2001 +++ mcd-0.3b/doc/CHANGES Sat Jul 28 01:24:19 2001 @@ -1,10 +1,15 @@ +0.3b: + changes to the drawingmethods (titles can be longer now) + cd-changes needs updating of titles (oh, i forgot it!) + added INSTALL (step by step manual, for installing mcd) + 0.3a: cddb works now (only freedb was tested!) drawing the titelinfo works now correct updated manpage updated mcd.lsm -0.3: +0.3: (deleted, use 0.3a instead!) cddb seems buggy somehow, i will fix it :) added cddb stuff in manpage added cddb stuff (ip only, no resolving stuff -> no bloat) diff -urN mcd-0.3a/doc/INSTALL mcd-0.3b/doc/INSTALL --- mcd-0.3a/doc/INSTALL Thu Jan 1 01:00:00 1970 +++ mcd-0.3b/doc/INSTALL Fri Jul 27 20:17:35 2001 @@ -0,0 +1,18 @@ + + Installing mcd +================ + +1. Possibly, edit the Makefile for options for your compiler, etc: + $ vi Makefile + +2. Read the comments in params.h, and edit the #define's for your needs: + $ vi params.h + +3. Build it: + $ make + +4. Install the binary and the manpage: + # make install + +5. Edit the global /etc/profile, for setting up the new environment variables + $ vi /etc/profile (!CDDB_SERVER contains an IP:PORT, not HOST:PORT!) diff -urN mcd-0.3a/doc/README mcd-0.3b/doc/README --- mcd-0.3a/doc/README Fri Jul 27 08:09:35 2001 +++ mcd-0.3b/doc/README Sat Jul 28 01:27:55 2001 @@ -4,9 +4,9 @@ - mcd is a small (maybe the smallest) cd-player for _linux_ - it compiles/runs out off the box -- it can be compiled against dietlibc (~15kb static!) +- it can be compiled against dietlibc (~16kb static!) - working play methods: reapeat cd, repeat track and intro -- since version 0.3, cddb title stuff is also included (0.3a correctly) +- since version 0.3a, minimal cddb title download is also included @@ -45,7 +45,7 @@ ====== - term resizing works correct, since version 0.2 (if not started from mc - (btw: a new rewrite of the mc will be my next project ...mmc?) + (btw: a new small mc will be my next project ...mmc?) - maybe some things of the wishlist... (if someone ask me, i will do it) - see, if cddb works well diff -urN mcd-0.3a/draw.c mcd-0.3b/draw.c --- mcd-0.3a/draw.c Fri Jul 27 08:35:59 2001 +++ mcd-0.3b/draw.c Sat Jul 28 01:41:55 2001 @@ -3,13 +3,15 @@ * in an application designed to run on any Microsoft(tm) platfrom. * * See doc/README for more information about COPYING terms. - * - * XXX: For smaller terminals, and long titles we need some reordering. */ #include "mcd.h" +short maxx,maxy; /* screenmaxima */ + static void draw_hline(int i, char *ch); /* draw an hline */ static void draw_box(int x1, int y1, int x2, int y2); /* draw a box */ static void draw_method(char *msg); +static void draw_initscr(void); +static void draw_tracks(struct mcd *cd); static void draw_hline(int i, char *ch) { if (i<0) return; @@ -36,10 +38,43 @@ return; } -/* GLOBAL */ -short maxx,maxy; /* screenmaxima */ +static void draw_initscr(void) { + register int i; + show1(C_NORMAL T_CLEAR C_BOX); + draw_box(1,1,maxx,maxy); /* the bigbox */ + gotoxyw(1,9, AC_ML); + draw_hline(maxx-1,AC_HL); + show1(AC_MR); /* border */ + + if (cddb) { /* vline */ + gotoxy(34,1);show1(AC_MB); + for (i=2;i<6;i++) { + gotoxy(34,i); + show1(AC_VL); + } + gotoxy(34,i);show1(AC_BL); + draw_hline(maxx-34,AC_HL); + show1(AC_MR); + } + show1(C_HEADLINE); + gotoxyw(3,2, "mcd version " MCD_VERSION); + if (cddb) gotoxyw(36,2,"freedb info"); + gotoxyw(3,10,"tracklist"); + show1(C_DESCRIPT); + gotoxyw(3,4, "Status:"); + gotoxyw(3,5, "Method:"); + gotoxyw(3,6, "Volume:"); + gotoxyw(3,7, "Track:"); + gotoxyw(3,8, "CD:"); + if (cddb) { + gotoxyw(36,4,"Source:"); + gotoxyw(36,5,"DiscID:"); + } + return; +} -void draw_tracks(struct mcd *cd) { +/* this function looks strange since cddb =:) */ +static void draw_tracks(struct mcd *cd) { register int i,m; /* title/modifier/realtitle */ int y=0,x=0; /* x,y==diffs to real */ @@ -58,66 +93,35 @@ if (i==cd->title[0]) show1(C_NORMAL); /* current */ } - show1(C_STATUS); /* trackmodifier */ - gotoxy(13,10); - _printf("(%d)", pluskey); - if (cddb) { /* if we have cddb */ - gotoxy(57,2);_printf("%08x",cd_discid(&cd[0])); - gotoxy(67,2); - if (cddb==CDDB_LOCAL) show1("(local file)"); - else _printf("(via %s:%s)",ip,port); /* can only be REMOTE */ + gotoxyw(44,4,C_STATUS); + if (cddb==CDDB_LOCAL) show1("local file"); + else _printf("remote, via %s:%s",ip,port); /* can only be REMOTE */ + gotoxy(44,5);_printf("%08x",cd_discid(&cd[0])); /* titelinfo */ - gotoxy(36,5); _printf("%s",cd->t[0].name); - gotoxy(36,7); _printf("%s",cd->t[cd->title[0]].name); - for (i=strlen(cd->t[cd->title[0]].name)+36;it[0].name); /* always */ + if (x) { + /* we display only current */ + gotoxy(18,7); _printf("%s" C_NORMAL, cd->t[cd->title[0]].name); + for (i=strlen(cd->t[cd->title[0]].name)+19;i<=maxx;i++) + write(1," ",1); /* clear old titleinfos */ + } else { + /* we display all title */ + gotoxy(16,9);show1(C_BOX AC_MB); + for (i=10;ititle[1];i++) { - gotoxy(16,10+i); + gotoxy(18,10+i); if (i==cd->title[0]) show1(T_BOLD); _printf("%s",cd->t[i].name); if (i==cd->title[0]) show1(C_NORMAL); } - } - } - return; -} - -void draw_initscr(void) { - register int i; - show1(C_NORMAL T_CLEAR C_BOX); - draw_box(1,1,maxx,maxy); - gotoxyw(1,9, AC_ML);draw_hline(maxx-1,AC_HL); - show1(AC_MR); - if (cddb) { - gotoxy(34,1);show1(AC_MB); - for (i=2;i<9;i++) { - gotoxy(34,i); - show1(AC_VL); - } - gotoxy(34,9);show1(AC_MT); - } - - show1(C_HEADLINE); - gotoxyw(3,2, "mcd version " MCD_VERSION); - if (cddb) gotoxyw(36,2,"freedb info (discid: )"); - gotoxyw(3,10,"tracklist"); - - show1(C_DESCRIPT); - gotoxyw(3,4, "Status:"); - gotoxyw(3,5, "Method:"); - gotoxyw(3,6, "Volume:"); - gotoxyw(3,7, "Track:"); - gotoxyw(3,8, "CD:"); - - if (cddb) { - gotoxyw(36,4, "Artist / Album:"); - gotoxyw(36,6, "Current Title:"); - } + } /* all title */ + } /* cddb */ + show1(C_STATUS); /* trackmodifier */ + gotoxy(13,10); + _printf("(%d)", pluskey); return; } @@ -142,8 +146,8 @@ signal(SIGWINCH,tty_resize); show1(C_NORMAL T_CLEAR); tty_getsize(&maxx,&maxy); - if (maxx<80 || maxy<13) { - show2(T_NORMAL T_CLEAR "Sorry, you need at least a termsize of 80x13.\n"); + if (maxx<78 || maxy<13) { + show2(T_NORMAL T_CLEAR "Sorry, you need at least a termsize of 78x13.\n"); tty_mode(TERM_QUIT); } cddb=cd_readtracks(&cd[0]); @@ -186,16 +190,13 @@ /* always */ gotoxy(11,7); - _printf("%02d:%02d (%2d/%2d)", + _printf("%02d:%02d", cd->cds.cdsc_reladdr.msf.minute, - cd->cds.cdsc_reladdr.msf.second, - cd->title[0],cd->title[1]); + cd->cds.cdsc_reladdr.msf.second); gotoxy(11,8); - _printf("%02d:%02d (%02d:%02d)", + _printf("%02d:%02d", cd->cds.cdsc_absaddr.msf.minute, - cd->cds.cdsc_absaddr.msf.second, - cd->cdte[0].cdte_addr.msf.minute, - cd->cdte[0].cdte_addr.msf.second); + cd->cds.cdsc_absaddr.msf.second); show1(T_HOME); return; } diff -urN mcd-0.3a/mcd.1 mcd-0.3b/mcd.1 --- mcd-0.3a/mcd.1 Fri Jul 27 08:19:15 2001 +++ mcd-0.3b/mcd.1 Fri Jul 27 20:24:14 2001 @@ -1,5 +1,5 @@ .\" Tino Reichardt -.TH MCD 1 "2001-07-27" "mcd-0.3a" "User commands" +.TH MCD 1 "2001-07-27" "mcd-0.3b" "User commands" .SH "NAME" mcd \- a small cdplayer for linux .SH "SYNOPSIS" @@ -58,6 +58,7 @@ \fB0\fP @no errors occured / normal quit \fB1\fP @the given cd-device isn't a cd-device \fB2\fP @your cd seems to be sth. other then a CD-Audio or CD-Mixed +\fB3\fP @some error while processing terminal code .TE .SH "NOTES" Some terminals don't like the default escape-sequences from params.h ... if diff -urN mcd-0.3a/mcd.c mcd-0.3b/mcd.c --- mcd-0.3a/mcd.c Fri Jul 27 07:48:36 2001 +++ mcd-0.3b/mcd.c Fri Jul 27 19:53:31 2001 @@ -88,10 +88,12 @@ case 'E': case 'e': cd_eject(&cd->fd); + updates[U_ALL]=1; break; case 'C': case 'c': cd_close(&cd->fd); + updates[U_ALL]=1; break; case '?': case 'H': diff -urN mcd-0.3a/mcd.h mcd-0.3b/mcd.h --- mcd-0.3a/mcd.h Fri Jul 27 08:08:33 2001 +++ mcd-0.3b/mcd.h Fri Jul 27 20:06:21 2001 @@ -30,7 +30,7 @@ #include "params.h" -#define MCD_VERSION "0.3a" +#define MCD_VERSION "0.3b" /* METHODS */ #define M_PLAY_CD 0 /* play whole cd and stop */ @@ -39,12 +39,11 @@ #define M_INTRO 3 /* play first ten seconds of each track and stop */ /* UPDATES */ -#define U_NODISC 0 /* nothing... special, for nodisk-status */ -#define U_STATUS 1 /* only titles are updated */ -#define U_METHOD 2 /* status-method is updated */ -#define U_VOLUME 3 /* status-volume is updated */ -#define U_TRACKS 4 /* all tracks are updated */ -#define U_ALL 5 /* really ALL is updated */ +#define U_STATUS 0 /* only titles are updated */ +#define U_METHOD 1 /* status-method is updated */ +#define U_VOLUME 2 /* status-volume is updated */ +#define U_TRACKS 3 /* all tracks are updated */ +#define U_ALL 4 /* really ALL is updated */ #define CDDB_NOENT 0 /* no local cddb, no remote access*/ #define CDDB_LOCAL 1 /* local entry is used */ @@ -104,10 +103,8 @@ /* draw.c */ extern short maxx,maxy; -extern void draw_initscr(void); extern void draw_updatescr(struct mcd *cd); extern void draw_status(char *msg, short update); -extern void draw_tracks(struct mcd *cd); /* ****** */ /* misc.c */ diff -urN mcd-0.3a/mcd.lsm mcd-0.3b/mcd.lsm --- mcd-0.3a/mcd.lsm Fri Jul 27 06:16:09 2001 +++ mcd-0.3b/mcd.lsm Sat Jul 28 01:29:22 2001 @@ -1,16 +1,15 @@ Begin3 Title: mcd -Version: 0.3 -Entered-date: 07/24/2001 +Version: 0.3b +Entered-date: 07/28/2001 Description: Is a small cd player application with a curses like interface. Has a track database, supports remote/local cddb - track data, - different play modes and volume control. + track data, different play modes and volume control. Keywords: cd, player, audio, sound, curses, dietlibc, cddb, freedb Author: Tino Reichardt Primary-site: http://www.mcmilk.de/projects/mcd/ - ~20kB mcd-0.3a.tar.gz - ~16kB mcd-0.3a.gz (static binary!) + ~21kB mcd-0.3b.tar.gz + ~16kB mcd-0.3b.gz (static binary!) Platforms: Linux, cdrom, sound Copying-policy: GPL2 End diff -urN mcd-0.3a/params.h mcd-0.3b/params.h --- mcd-0.3a/params.h Thu Jul 26 07:50:47 2001 +++ mcd-0.3b/params.h Sat Jul 28 01:29:57 2001 @@ -8,7 +8,7 @@ #define CDROM_DEFAULT "/dev/cdrom" #define CDDB_CREATMODE 0644 /* used, for new entries */ -#define CDDB_TITLEMAX 100 /* used, for new entries */ +#define CDDB_TITLEMAX 62 /* max size a title my have on terminals */ #define MCD_INTRO_TIME 10 /* seconds for the intro */ #define MCD_CDAUDIO_MAX 99 /* maxtracks of the cd (RedBook) */ @@ -21,6 +21,7 @@ /* * ESC seqences, you may change some of them ... * (these are vt100, xterm, linux, xterm-color compatible) + * The eterm-boxes looks ugly :( */ /* needed */ diff -urN mcd-0.3a/tty.c mcd-0.3b/tty.c --- mcd-0.3a/tty.c Sun Jul 22 19:23:17 2001 +++ mcd-0.3b/tty.c Sat Jul 28 01:29:56 2001 @@ -14,7 +14,7 @@ case TERM_INIT: if (tcgetattr(0, &told)) { show2("Saving Terminalmode failed."); - exit(1); + exit(2); } tnew = told; tnew.c_lflag &= ~(ICANON|ECHO|ECHOE|ICRNL); /* we want it this way |ISIG*/ @@ -22,13 +22,13 @@ tnew.c_cc[VTIME] = 0;/* don't wait */ if (tcsetattr(0, TCSANOW, &tnew)) { show2("Setting Terminal to new values failed."); - exit(1); + exit(2); } break; case TERM_QUIT: if (tcsetattr(0, TCSANOW, &told)) { show2("Setting Terminal to old defaults failed."); - exit(1); + exit(2); } exit(0); }