From 979639f4e2145693ed405878e5b3c567b4f831cb Mon Sep 17 00:00:00 2001 From: dockes Date: Sun, 1 Jul 2007 06:52:21 +0000 Subject: [PATCH] audio tags support improvement: flac+ogg. use FORPREVIEW --- src/filters/rclid3 | 110 ++++++++++++++++++++++++++++++++++++++++ src/sampleconf/mimeconf | 23 ++++++--- src/sampleconf/mimemap | 4 +- src/sampleconf/mimeview | 4 +- 4 files changed, 131 insertions(+), 10 deletions(-) create mode 100755 src/filters/rclid3 diff --git a/src/filters/rclid3 b/src/filters/rclid3 new file mode 100755 index 00000000..873d3fa3 --- /dev/null +++ b/src/filters/rclid3 @@ -0,0 +1,110 @@ +#!/bin/sh +# @(#$Id: rclid3,v 1.1 2007-07-01 06:52:21 dockes Exp $ (C) 2004 J.F.Dockes +#================================================================ +# rclmedia +# Handle media files for recoll. This currently returns an empty +# document to let the indexer process the file names as terms, but +# we might want to extract mp3 tags one day +#================================================================ +# set variables +LANG=C ; export LANG +LC_ALL=C ; export LC_ALL +progname="rclmedia" +filetype=media + + + +#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 + +# protect access to our temp files and directories +umask 77 + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + +checkcmds id3info + +# output the result +echo '' +#echo '' "$title" '' +echo '' +echo '' +echo '
'
+
+nocaptionexp='s/===.*://'
+kpcaptionexp='s/===[^(]*//'
+
+if test X$RECOLL_FILTER_FORPREVIEW = Xyes ; then
+    captionexp=$kpcaptionexp
+else
+    captionexp=$nocaptionexp
+fi
+
+id3info "$infile" | \
+   sed -e '/Tag information for/d' \
+       -e "$captionexp" \
+       -e 's/'
+echo ''
+
+# exit normally
+exit 0
diff --git a/src/sampleconf/mimeconf b/src/sampleconf/mimeconf
index 9625d5d3..6a14ff41 100644
--- a/src/sampleconf/mimeconf
+++ b/src/sampleconf/mimeconf
@@ -1,4 +1,4 @@
-# @(#$Id: mimeconf,v 1.31 2007-06-22 06:14:04 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: mimeconf,v 1.32 2007-07-01 06:52:21 dockes Exp $  (C) 2004 J.F.Dockes
 
 # Recoll : associations of mime types to processing filters.
 # There are different sections for decompression, 'interning' for indexing
@@ -27,6 +27,7 @@ application/x-bzip2 =  uncompress rcluncomp bunzip2 %f %t
 # document in simple html format, have a look at the scripts.
 [index]
 application/msword = exec rcldoc
+application/ogg = exec rclogg
 application/pdf = exec rclpdf
 application/postscript = exec rclps
 application/vnd.ms-powerpoint = exec rclppt
@@ -43,10 +44,11 @@ application/vnd.sun.xml.writer.global = exec rclsoff
 application/vnd.sun.xml.writer.template = exec rclsoff
 application/x-abiword = exec rclabw
 application/x-dvi = exec rcldvi
+application/x-flac = exec rclflac
 application/x-lyx = exec rcllyx
 application/x-kword = exec rclkwd
 application/x-scribus = exec rclscribus
-audio/mpeg = exec rclmedia
+audio/mpeg = exec rclid3
 image/vnd.djvu = exec rcldjvu
 image/jpeg = exec rcljpeg
 message/rfc822 = internal
@@ -61,6 +63,7 @@ text/x-man = exec rclman
 # Icons to be used in the result list if required by gui config
 [icons]
 application/msword = wordprocessing
+application/ogg = sownd
 application/pdf = pdf
 application/postscript = postscript
 application/vnd.ms-excel = spreadsheet
@@ -75,9 +78,10 @@ application/vnd.sun.xml.writer = wordprocessing
 application/vnd.sun.xml.writer.global = wordprocessing
 application/vnd.sun.xml.writer.template = wordprocessing
 application/x-abiword = wordprocessing
-application/x-kword = wordprocessing
-application/x-fsdirectory = folder
 application/x-dvi = document
+application/x-flac = sownd
+application/x-fsdirectory = folder
+application/x-kword = wordprocessing
 audio/mpeg = sownd
 image/jpeg = image
 image/png = image
@@ -85,8 +89,8 @@ image/vnd.djvu = document
 message/rfc822 = message
 text/html = html
 text/plain = txt
-text/x-mail = message
 text/x-c = source
+text/x-mail = message
 
 
 [categories]
@@ -116,9 +120,12 @@ presentation = application/vnd.ms-powerpoint \
 	        application/vnd.sun.xml.impress \
 	        application/vnd.sun.xml.impress.template
 
-media = audio/mpeg \
-        image/jpeg \
-        image/png \
+media = \
+      audio/mpeg \
+      application/ogg \
+      application/x-flac \
+      image/jpeg \
+      image/png \
 
 message = message/rfc822 \
 	   text/x-gaim-log \
diff --git a/src/sampleconf/mimemap b/src/sampleconf/mimemap
index aeac1ac6..a66d0fb9 100644
--- a/src/sampleconf/mimemap
+++ b/src/sampleconf/mimemap
@@ -1,4 +1,4 @@
-# @(#$Id: mimemap,v 1.23 2007-06-15 11:41:50 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: mimemap,v 1.24 2007-07-01 06:52:21 dockes Exp $  (C) 2004 J.F.Dockes
 # Recoll: associations of file name extensions to mime types
 
 .txt = text/plain
@@ -65,6 +65,8 @@
 .rtf = text/rtf
 
 .mp3 = audio/mpeg
+.flac = application/x-flac
+.ogg = application/ogg
 .png = image/png
 .jpg = image/jpeg
 
diff --git a/src/sampleconf/mimeview b/src/sampleconf/mimeview
index 474739f4..b5824ace 100644
--- a/src/sampleconf/mimeview
+++ b/src/sampleconf/mimeview
@@ -1,4 +1,4 @@
-# @(#$Id: mimeview,v 1.6 2007-06-15 11:41:50 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: mimeview,v 1.7 2007-07-01 06:52:21 dockes Exp $  (C) 2004 J.F.Dockes
 
 ## ##########################################
 # External viewers, launched by the recoll GUI when you click on a result
@@ -12,6 +12,7 @@ application/x-kword = kword %f
 application/x-abiword = abiword %f
 
 application/msword = openoffice %f
+application/ogg = xmms %f
 application/pdf  = xpdf %f
 application/postscript = gv %f
 application/vnd.ms-excel = openoffice %f
@@ -28,6 +29,7 @@ application/vnd.sun.xml.writer.global = openoffice %f
 application/vnd.sun.xml.writer.template = openoffice %f
 application/x-fsdirectory = rox %f
 application/x-dvi = xdvi %f
+application/x-flac = xmms %f
 application/x-lyx = lyx %f
 application/x-scribus = scribus %f
 audio/mpeg = xmms %f