Compare commits

...

9 Commits

7 changed files with 54 additions and 37 deletions

View File

@ -1,3 +1,12 @@
0.8.5 / 2023-08-16 Fabian Kurz <fabian@fkurz.net>
* Allow output file names to be up to PATH_MAX (typ. 4096)
characters long (tnx SQ6JNX)
* If the input file ends without a space or newline, don't
ignore the last word
* Change "ì" from ".." to ".---." (tnx IZ4APU)
* Add some missing letters for Arabic, Greek, Hebrew
* Fixes in the Makefile (thanks Stéphan Kochen)
0.8.4 / 2021-04-07 Fabian Kurz <fabian@fkurz.net>
* If chapter separator is empty (-c "") or starts with
a dash (-c "-"), do not append a chapter number to filenames
@ -5,7 +14,6 @@
* Fix Farnsworth CW timing (tnx DM4SG for the patch)
* Location of configuration file can be specified with -E option
0.8.3 / 2020-05-23 Fabian Kurz <fabian@fkurz.net>
* Added lowercase Greek alphabet
* Added multiple language support by GNU gettext.

View File

@ -1,8 +1,6 @@
# ebook2cw Makefile -- Fabian Kurz, DJ1YFK -- http://fkurz.net/ham/ebook2cw.html
#
# $Id$
# ebook2cw Makefile -- Fabian Kurz, DJ5CW -- http://fkurz.net/ham/ebook2cw.html
VERSION=0.8.4
VERSION=0.8.5
DESTDIR ?= /usr
# Set to NO to compile without Lame/Ogg-vorbis support
@ -29,23 +27,24 @@ endif
all: ebook2cw
ebook2cw: ebook2cw.c codetables.h
gcc ebook2cw.c -pedantic -Wall -Wno-format-truncation -lm $(LDFLAGS) $(CFLAGS) -o ebook2cw
$(CC) ebook2cw.c -pedantic -Wall -Wno-format-truncation -lm $(LDFLAGS) $(CFLAGS) -o ebook2cw
msgfmt -o po/de.mo po/de.po
cgi: ebook2cw.c codetables.h
gcc -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -D CGI -o cw.cgi
$(CC) -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -D CGI -o cw.cgi
cgibuffered: ebook2cw.c codetables.h
gcc -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -D CGI -D CGIBUFFERED -o cw.cgi
$(CC) -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -D CGI -D CGIBUFFERED -o cw.cgi
static:
gcc -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -o ebook2cw
$(CC) -static ebook2cw.c $(LDFLAGS) -lm $(CFLAGS) -o ebook2cw
install:
install -d -v $(DESTDIR)/share/man/man1/
install -d -v $(DESTDIR)/bin/
install -d -v $(DESTDIR)/share/doc/ebook2cw/
install -d -v $(DESTDIR)/share/doc/ebook2cw/examples/
install -d -v $(DESTDIR)/share/locale/de/LC_MESSAGES/
install -s -m 0755 ebook2cw $(DESTDIR)/bin/
install -m 0644 ebook2cw.1 $(DESTDIR)/share/man/man1/
install -m 0644 README $(DESTDIR)/share/doc/ebook2cw/

6
README
View File

@ -1,4 +1,4 @@
ebook2cw v0.8.4 - convert ebooks to morse code - Fabian Kurz, DJ1YFK
ebook2cw v0.8.5 - convert ebooks to morse code - Fabian Kurz, DJ5CW
---------------------------------------------------------------------
Website: https://fkurz.net/ham/ebook2cw.html
@ -20,7 +20,7 @@ Statically compiled binaries are available at the project website, for Linux
(i386) and Win32. Those should be suitable for most users.
2) Source
A Makefile is included; it compiles both under Linux and Windows (with MinGW).
A Makefile is included; it compiles under Linux, Windows (with MinGW) and OS X.
DESTDIR is /usr by default (so the binary will be in /usr/bin/).
Support for LAME and/or OGG can be disabled by USE_LAME=NO and USE_OGG=NO
respectively.
@ -47,6 +47,6 @@ Content-Length: header which may be required for some clients.
Contact
-------
Fabian Kurz, DJ1YFK <fabian@fkurz.net>
Fabian Kurz, DJ5CW (ex DJ1YFK) <fabian@fkurz.net>
https://fkurz.net/ham/ebook2cw.html

View File

@ -1,9 +1,7 @@
/*
* ISO 8859-1 and UTF-8 to Morse code mappings
* This file is part of ebook2cw and may be used under the same terms (GPL)
* (C) 2008-2017 Fabian Kurz, DJ1YFK
*
* $Id$
* (C) 2008-2022 Fabian Kurz, DJ5CW
*
* Currently included: ISO 8859-1
* - complete (all that can somehow be mapped)
@ -173,7 +171,7 @@ const static char *iso8859[] = {
"..-..", /* 'e */
".", /* ^e */
".", /* "e */
"..", /* `i */
".---.", /* `i */
"..", /* 'i */
"..", /* ^i */
"..", /* "i */
@ -265,7 +263,7 @@ const static char *utf8table[] = {
"..-..", /* 'e */
".", /* ^e */
".", /* "e */
"..", /* `i */
".---.", /* `i */
"..", /* 'i */
"..", /* ^i */
"..", /* "i */
@ -410,7 +408,7 @@ const static char *utf8table[] = {
/* Greek Alphabet, small letters */
".-", "-..." , "--.", "-..", ".", "--..", "....",
"-.-.", "..", "-.-", ".-..", "--", "-.", "-..-", "---",
".--.", ".-.", NULL, "...", "-", "-.--", "..-.", "----",
".--.", ".-.", "...", "...", "-", "-.--", "..-.", "----",
"--.-", ".--", NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -488,8 +486,8 @@ const static char *utf8table[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 1488-1514 Hebrew according to Wikipedia */
".-", "-...", "--.", "-..", "---", ".", "--..", "....",
"..-", "..", NULL, "-.-", ".-..", NULL, "--", "-.", NULL,
"-.-.", ".---", NULL, ".--.", NULL, ".--", "--.-", ".-.", "...",
"..-", "..", "-.-", "-.-", ".-..", "--", "--", "-.", "-.",
"-.-.", ".---", ".--.", ".--.", ".--", ".--", "--.-", ".-.", "...",
"-", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -502,11 +500,11 @@ const static char *utf8table[] = {
* 1569-1610
*/
".", NULL, NULL, NULL, NULL, NULL,
".-", "-...", NULL, "-", "-.-.",
".-", "-...", "-", "-", "-.-.",
".---", "....", "---", "-..", "--..", ".-.", "---.", "...",
"----", "-..-", "...-", "..-", "-.--", ".-.-", "--.", NULL,
NULL, NULL, NULL, NULL, NULL, "..-.", "--.-", "-.-",
".-..", "--", "-.", NULL, ".--", NULL, "..", NULL,
".-..", "--", "-.", "..-..", ".--", NULL, "..", NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

View File

@ -1,4 +1,4 @@
.TH ebook2cw 1 "APRIL 2021" Linux "User Manuals"
.TH ebook2cw 1 "AUGUST 2023" Linux "User Manuals"
.SH NAME
ebook2cw \- Convert ebooks to Morse code audio files (MP3/OGG)
.SH SYNOPSIS
@ -9,6 +9,8 @@ ebook2cw \- Convert ebooks to Morse code audio files (MP3/OGG)
ebook2cw is a command line program which converts a plain text ebook to Morse
code audio files. It works on several platforms, including Windows and Linux.
The default for INFILE is stdin.
A number of CW and audio parameters can be changed from their default values, by
command line switches or a config file (see below). These are (default values in brackets):
@ -147,7 +149,7 @@ ebook2cw can also be compiled to run as a CGI to serve MP3 and OGG files
on the fly for web applications.
.SH AUTHOR
Fabian Kurz, DJ1YFK <fabian@fkurz.net>
Fabian Kurz, DJ5CW <fabian@fkurz.net>
https://fkurz.net/ham/ebook2cw.html
.SH "SEE ALSO"

View File

@ -1,7 +1,7 @@
/*
ebook2cw - converts an ebook to Morse MP3/OGG-files
Copyright (C) 2007 - 2021 Fabian Kurz, DJ1YFK
Copyright (C) 2007 - 2023 Fabian Kurz, DJ5CW
https://fkurz.net/ham/ebook2cw.html
@ -57,6 +57,11 @@ source code looks properly indented with ts=4
#include <errno.h>
#endif
#include <limits.h> /* PATH_MAX */
#ifndef PATH_MAX /* Not defined e.g. on GNU/hurd */
#define PATH_MAX 4096
#endif
#include "codetables.h"
#ifndef VERSION
@ -141,8 +146,8 @@ typedef struct {
unsigned char *mp3buffer;
/* Chapter splitting */
char chapterstr[80], /* split chapters by this string */
chapterfilename[80], /* Prefix, e.g. "Chapter-" */
outfilename[256]; /* Full name of current outputfile */
chapterfilename[PATH_MAX-8], /* Prefix, e.g. "Chapter-" */
outfilename[PATH_MAX]; /* Full name of current outputfile */
/* time based splitting, seconds */
int chaptertime;
/* word based splitting */
@ -264,7 +269,7 @@ int main (int argc, char** argv) {
return EXIT_FAILURE;
}
printf(_("ebook2cw %s - (c) 2007 - 2021 by Fabian Kurz, DJ1YFK\n\n"), VERSION);
printf(_("ebook2cw %s - (c) 2007 - 2023 by Fabian Kurz, DJ5CW\n\n"), VERSION);
/*
* Find and read ebook2cw.conf
@ -523,9 +528,15 @@ cw.encoding = UTF8;
} /* word */
} /* eof */
/* If the file ends without newline or space, but directly with EOF after
* the last word, this one is lost, so we need to add it... */
if (strlen(word) && word[0] != '|' && word[0] != '#') {
makeword(mapstring(word, &cw), &cw);
chw++;
}
/* CGI: Add some silence (500ms) to the end of the file */
#ifdef CGI
add_silence(500, &cw);
@ -925,11 +936,11 @@ void openfile (int chapter, CWP *cw) {
/* If we have a chapter separator string, use format Chapter0001.mp3 */
if (strlen(cw->chapterstr) && cw->chapterstr[0] != '-') {
snprintf(cw->outfilename, 80, "%s%04d.%s", cw->chapterfilename,
snprintf(cw->outfilename, PATH_MAX, "%s%04d.%s", cw->chapterfilename,
chapter, (cw->encoder == MP3) ? "mp3" : "ogg");
}
else { /* otherwise just Chapter.mp3 */
snprintf(cw->outfilename, 80, "%s.%s", cw->chapterfilename,
snprintf(cw->outfilename, PATH_MAX, "%s.%s", cw->chapterfilename,
(cw->encoder == MP3) ? "mp3" : "ogg");
}
printf(_("Starting %s\n"), cw->outfilename);
@ -985,6 +996,7 @@ void help (void) {
printf(_(" [-u] [-S ISO|UTF] [-n] [-e eff.wpm] [-W space]\n"));
printf(_(" [-N snr] [-B filter bandwidth] [-C filter center]\n"));
printf(_(" [-T 0..2] [-g filename] [-l words] [-d seconds]\n"));
printf(_(" [-O for OGG output format] \n"));
printf(_(" [infile]\n\n"));
printf(_("defaults: 25 WpM, 600Hz, RT=FT=50, s=11025Hz, b=16kbps,\n"));
printf(_(" c=\"CHAPTER\", o=\"Chapter\" infile = stdin\n"));
@ -1287,7 +1299,7 @@ void setparameter (char i, char *value, CWP *cw) {
strncpy(cw->chapterstr, value, 78);
break;
case 'o':
strncpy(cw->chapterfilename, value, 78);
strncpy(cw->chapterfilename, value, PATH_MAX - 10);
break;
case 'a':
strncpy(cw->id3_author, value, 78);

View File

@ -1,10 +1,8 @@
# ebook2cw configuration file
#
# ebook2cw (c) 2008 by Fabian Kurz, DJ1YFK
# ebook2cw (c) 2008 - 2022 Fabian Kurz, DJ5CW
# http://fkurz.net/ham/ebook2cw.html
#
# $Id$
#
# In this file you can set the default parameters which ebook2cw
# uses. These parameters can be overridden by command line parameters.
#
@ -24,8 +22,8 @@ f=700
# ebook2cw by default supports almost all known special characters in CW,
# like umlauts, accented letters, etc. Complete tables are available at
# http://fkurz.net/ham/codes.html (UTF-8) and
# http://fkurz.net/ham/codes2.html (ISO 8859-1)
# https://fkurz.net/ham/codes.html (UTF-8) and
# https://fkurz.net/ham/codes2.html (ISO 8859-1)
#
# Many of these symbols are pretty unusual though, like the exclamation
# mark (! = ..--.) and you may prefer to replace them with a different