factored out filter script common code

This commit is contained in:
dockes 2007-02-06 15:08:23 +00:00
parent c3ad4341dc
commit 2f75b9acb0
14 changed files with 674 additions and 214 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rcldjvu,v 1.3 2007-01-30 11:36:02 dockes Exp $ (C) 2005 J.F.Dockes
# @(#$Id: rcldjvu,v 1.4 2007-02-06 15:08:22 dockes Exp $ (C) 2005 J.F.Dockes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -30,16 +30,27 @@
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rcldjvu"
filetype=dejavu
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert a djvu file to HTML text for recoll indexation.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -53,6 +64,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -60,11 +72,31 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds djvutxt djvused awk
# check the input file existence

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rcldoc,v 1.6 2007-01-30 11:36:02 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rcldoc,v 1.7 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
# Parts taken from Estraier:
#================================================================
# Estraier: a personal full-text search system
@ -20,20 +20,32 @@
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rcldoc"
filetype=ms-word
decoder="antiword -t -i 1 -m UTF-8"
# Not ready to use this for now (it outputs html, so the code below has to
# be simplified.)
#decoder="wvWare -1 -c UTF-8"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert a word file to unformatted HTML text.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -47,6 +59,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -54,20 +67,33 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
checkcmds awk antiword iconv
# check the input file existence
if test ! -f "$infile"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds awk antiword iconv
# output the result
# The strange 'BEGIN' setup is to prevent 'file' from thinking this file
# is an awk program

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rcldvi,v 1.3 2007-01-30 11:36:02 dockes Exp $ (C) 2006 J.F.Dockes
# @(#$Id: rcldvi,v 1.4 2007-02-06 15:08:22 dockes Exp $ (C) 2006 J.F.Dockes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -22,20 +22,32 @@
# or using catdvi. dvitops has given better results during tests, and is
# chosen first if available, but the dvitops/rclps combination is much
# slower than catdvi
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rcldvi"
filetype=dvi
# Show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert a dvi file to unformatted HTML text for recoll indexation.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
# Find rclps. Note: this only works because we are always executed with a
# full path
infile="$1"
rclps=`dirname $0`/rclps
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -50,24 +62,51 @@ iscmd()
esac
}
checkcmds()
{
for cmd in $*;do
if iscmd $cmd
then
a=1
else
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
# Find rclps. Note: this only works because we are always executed with a
# full path
rclps=`dirname $0`/rclps
decoder=""
if iscmd dvips -a iscmd pstotext ; then
decoder=dvips
else
elsif iscmd catdvi
decoder=catdvi
fi
if test X$decoder = X ; then
echo "$progname: did not find either catdvi or dvips." 1>&2
exit 1
fi
# check the input file existence
if test ! -f "$infile"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
exit 1
senderror NOTFOUND dvips catdvi
fi
if test X$decoder = Xdvips ; then

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclgaim,v 1.2 2005-11-21 14:32:53 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclgaim,v 1.3 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
# Parts taken from Estraier:
#================================================================
# Estraier: a personal full-text search system
@ -15,18 +15,28 @@
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclsoff"
progname="rclgaim"
filetype="gaim log"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert a gaim log to unformatted HTML text for Recoll.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -48,21 +58,33 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
checkcmds awk iconv
# check the input file existence
if test ! -f "$infile"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds awk iconv
awk '
# First line: parse from, to , output html header
NR == 1 {

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rcllyx,v 1.4 2007-01-23 07:23:12 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rcllyx,v 1.5 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
# There may still be code from Estraier in here:
#================================================================
# Estraier: a personal full-text search system
@ -29,23 +29,27 @@
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rcllyx"
filetype=lyx
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Extract lyx text as basic HTML.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
# check the input file existence
if test ! -f "$infile"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
exit 1
fi
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -59,6 +63,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -66,12 +71,31 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds lyx iconv
# We need a temporary directory

111
src/filters/rclman Executable file
View File

@ -0,0 +1,111 @@
#!/bin/sh
# @(#$Id: rclman,v 1.1 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
# Parts taken from Estraier:
#================================================================
# Estraier: a personal full-text search system
# Copyright (C) 2003-2004 Mikio Hirabayashi
#================================================================
#================================================================
# rclman
# Process a manual page with groff and output html
# We'd like to use -Thtml, but this doesn't seem to be always available.
# So we use -Tutf8 and postprocess this to remove the ^H overstriking
#
#================================================================
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclman"
filetype=man
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
cmd=$1
case $cmd in
*/*)
if test -x $cmd ; then return 0; else return 1; fi ;;
*)
oldifs=$IFS; IFS=":"; set -- $PATH; IFS=$oldifs
for d in $*;do test -x $d/$cmd && return 0;done
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
if iscmd $cmd
then
a=1
else
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds groff sed awk iconv
# The strange 'BEGIN' setup is to prevent 'file' from thinking this file
# is an awk program
groff -man -Tutf8 < "$infile" | sed -e 's/.//g' -e 's/.//g' |\
awk 'BEGIN'\
' {
print "<html><head><title></title>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
print "</head>\n<body>\n<p>"
}
{
gsub(/&/, "\\&amp;", $0)
gsub(/</, "\\&lt;", $0)
gsub(/>/, "\\&gt;", $0)
print $0 "<br>"
}
END {
print "</p></body></html>"
}' | iconv -f UTF-8 -t UTF-8 -c -s
# exit normally
exit 0

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclmedia,v 1.2 2006-04-04 16:03:28 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclmedia,v 1.3 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
#================================================================
# rclmedia
# Handle media files for recoll. This currently returns an empty
@ -9,17 +9,27 @@
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclsoff"
progname="rclmedia"
filetype=media
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Process a media file for recoll indexation.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -33,25 +43,39 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
cmdsok=0
for cmd in $*;do
if iscmd $cmd
then
cmdsok=1
a=1
else
cmdsok=0
senderror HELPERNOTFOUND $cmd
fi
done
}
# check the input file existence
if test ! -f "$infile"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds id3info
# output the result
@ -60,11 +84,11 @@ echo '<html><head>'
echo '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">'
echo '</head><body>'
echo '<pre>'
if test X$cmdsok = X1 ; then
id3info "$infile" | \
id3info "$infile" | \
sed -e 's/</&lt;/g' -e 's/&/&amp;/g' -e 's/===.*://' | \
grep -v 'Tag information for'
fi
echo '</pre>'
echo '</body></html>'

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclpdf,v 1.7 2007-01-30 11:36:02 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclpdf,v 1.8 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
# This is copied almost verbatim from Estraier:
#================================================================
# Estraier: a personal full-text search system
@ -31,23 +31,27 @@ optionraw=-raw
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclpdf"
filetype=pdf
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Strip a file of PDF and extract its text as HTML.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
# check the input file existence
if test ! -f "$infile"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
exit 1
fi
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -61,6 +65,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -68,11 +73,31 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds pdftotext iconv awk
# Run pdftotext and fix the result (add a charset tag and fix the html escaping

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclppt,v 1.1 2006-09-05 09:52:23 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclppt,v 1.2 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@ -27,17 +27,28 @@
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclsoff"
progname="rclppt"
filetype=powerpoint
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Process a powerpoint file for recoll indexation.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -51,25 +62,39 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
cmdsok=0
for cmd in $*;do
if iscmd $cmd
then
cmdsok=1
a=1
else
cmdsok=0
senderror HELPERNOTFOUND $cmd
fi
done
}
# check the input file existence
if test ! -f "$infile"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds catppt
if test X$cmdsok = X0 ; then
printf "Catppt not found"

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclps,v 1.8 2007-01-30 11:36:02 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclps,v 1.9 2007-02-06 15:08:23 dockes Exp $ (C) 2004 J.F.Dockes
# Parts taken from Estraier:
#================================================================
# Estraier: a personal full-text search system
@ -24,21 +24,28 @@ LC_ALL=C ; export LC_ALL
progname="rclps"
decoder=pstotext
#decoder=ps2ascii
filetype=postscript
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert a postscript file to unformatted HTML text.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
if test "X$infile" = X- ; then
cmd=$decoder
else
cmd="$decoder $1"
fi
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -52,6 +59,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -59,20 +67,33 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
checkcmds $decoder iconv awk
# check the input file existence
if test "X$infile" != X- -a ! -f "$infile"
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds $decoder iconv awk
# output the result
# The strange 'BEGIN' setup is to prevent 'file' from thinking this file
# is an awk program

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclrtf,v 1.3 2007-01-30 11:36:02 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclrtf,v 1.4 2007-02-06 15:08:23 dockes Exp $ (C) 2004 J.F.Dockes
# Some inspiration from estraier
#================================================================
# rclrtf
@ -7,28 +7,31 @@
# http://www.gnu.org/software/unrtf/unrtf.html
#================================================================
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclrtl"
filetype=rtf
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert RTF to HTML for Recoll input.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
# check the input file existence
if test ! -f "$infile"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
exit 1
fi
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -42,6 +45,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -49,11 +53,31 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds awk unrtf
# output the result

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclscribus,v 1.2 2007-01-24 11:15:56 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclscribus,v 1.3 2007-02-06 15:08:23 dockes Exp $ (C) 2004 J.F.Dockes
# There may still be code from Estraier in here:
#================================================================
# Estraier: a personal full-text search system
@ -18,23 +18,27 @@
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclscribus"
filetype=Scribus
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Extract scribus text as basic HTML.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
# check the input file existence
if test ! -f "$infile"
then
printf '%s: %s: no such file\n' "$progname" "$infile"
exit 1
fi
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -48,6 +52,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -55,11 +60,31 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds grep awk sed
# A small sed program to join lines where they are broken inside an

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclsoff,v 1.8 2007-01-30 11:36:02 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclsoff,v 1.9 2007-02-06 15:08:23 dockes Exp $ (C) 2004 J.F.Dockes
# Parts taken from Estraier:
#================================================================
# Estraier: a personal full-text search system
@ -11,22 +11,32 @@
#
#================================================================
# set variables
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclsoff"
filetype=openoffice
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Convert an openoffice file to unformatted HTML text.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -40,6 +50,7 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
for cmd in $*;do
@ -47,11 +58,31 @@ checkcmds()
then
a=1
else
echo $cmd not found 1>&2
exit 1
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
checkcmds awk iconv unzip
# check the input file existence

View File

@ -1,5 +1,5 @@
#!/bin/sh
# @(#$Id: rclxls,v 1.2 2006-11-20 15:28:30 dockes Exp $ (C) 2004 J.F.Dockes
# @(#$Id: rclxls,v 1.3 2007-02-06 15:08:23 dockes Exp $ (C) 2004 J.F.Dockes
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@ -29,16 +29,27 @@
LANG=C ; export LANG
LC_ALL=C ; export LC_ALL
progname="rclxls"
filetype=excel
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
printf 'Process an excel file for recoll indexation.\n'
printf 'Usage: %s [infile]\n' "$progname"
exit 1
fi
infile="$1"
#RECFILTCOMMONCODE
##############################################################################
# !! Leave the previous line unmodified!! Code imported from the
# recfiltcommon file
# Utility code common to all shell filters. This could be sourced at run
# time, but it's slightly more efficient to include the code in the
# filters at build time (with a sed script).
# Describe error in a way that can be interpreted by our caller
senderror()
{
echo RECFILTERROR $*
# Also alert on stderr just in case
echo ":2:$progname::: $*" 1>&2
exit 1
}
iscmd()
{
@ -52,19 +63,39 @@ iscmd()
return 1 ;;
esac
}
checkcmds()
{
cmdsok=0
for cmd in $*;do
if iscmd $cmd
then
cmdsok=1
a=1
else
cmdsok=0
senderror HELPERNOTFOUND $cmd
fi
done
}
# show help message
if test $# -ne 1 -o "$1" = "--help"
then
echo "Convert a $filetype file to HTML text for Recoll indexing."
echo "Usage: $progname [infile]"
exit 1
fi
infile="$1"
# check the input file existence (may be '-' for stdin)
if test "X$infile" != X- -a ! -f "$infile"
then
senderror INPUTNOSUCHFILE "$infile"
fi
##############################################################################
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
# check the input file existence
if test ! -f "$infile"
then