diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml
index 72afc01e..ee366a95 100644
--- a/src/doc/user/usermanual.sgml
+++ b/src/doc/user/usermanual.sgml
@@ -2947,6 +2947,11 @@ while query.next >= 0 and query.next < nres:
Zip archives need Python
(and the standard zipfile module).
+ Rar archives need
+ Python, the
+ rarfile Python module and the
+ unrar utility.
+
Midi karaoke files need
Python and the
diff --git a/src/filters/rclrar b/src/filters/rclrar
new file mode 100755
index 00000000..094f1fff
--- /dev/null
+++ b/src/filters/rclrar
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+
+# Rar file filter for Recoll
+# Adapted from the Zip archive filter by mroark.
+# Copyright (C) 2004 J.F.Dockes + mroark for rar bits
+# 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
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+import rclexecm
+try:
+ from rarfile import RarFile
+except:
+ print "RECFILTERROR HELPERNOTFOUND python:rarfile"
+ sys.exit(1);
+
+# Requires RarFile python module. Try "sudo pip install rarfile"
+#
+# This is identical to rclzip except I did a search/replace from zip
+# to rar, and changed this comment.
+class RarExtractor:
+ def __init__(self, em):
+ self.currentindex = 0
+ self.em = em
+
+ def extractone(self, ipath):
+ #self.em.rclog("extractone: [%s]" % ipath)
+ docdata = ""
+ try:
+ docdata = self.rar.read(ipath)
+ ok = True
+ except Exception, err:
+# self.em.rclog("extractone: failed: [%s]" % err)
+ ok = False
+ iseof = rclexecm.RclExecM.noteof
+ if self.currentindex >= len(self.rar.namelist()) -1:
+ iseof = rclexecm.RclExecM.eofnext
+ if isinstance(ipath, unicode):
+ ipath = ipath.encode("utf-8")
+ return (ok, docdata, ipath, iseof)
+
+ ###### File type handler api, used by rclexecm ---------->
+ def openfile(self, params):
+ self.currentindex = 0
+ try:
+ self.rar = RarFile(params["filename:"])
+ return True
+ except:
+ return False
+
+ def getipath(self, params):
+ ipath = params["ipath:"]
+ ok, data, ipath, eof = self.extractone(ipath)
+ if ok:
+ return (ok, data, ipath, eof)
+ # Not found. Maybe we need to decode the path?
+ try:
+ ipath = ipath.decode("utf-8")
+ return self.extractone(ipath)
+ except Exception, err:
+ return (ok, data, ipath, eof)
+
+ def getnext(self, params):
+ if self.currentindex >= len(self.rar.namelist()):
+ #self.em.rclog("getnext: EOF hit")
+ return (False, "", "", rclexecm.RclExecM.eofnow)
+ else:
+ ret= self.extractone(self.rar.namelist()[self.currentindex])
+ self.currentindex += 1
+ return ret
+
+# Main program: create protocol handler and extractor and run them
+proto = rclexecm.RclExecM()
+extract = RarExtractor(proto)
+rclexecm.main(proto, extract)
diff --git a/src/sampleconf/mimeconf b/src/sampleconf/mimeconf
index 0eb0dc48..a9a21aef 100644
--- a/src/sampleconf/mimeconf
+++ b/src/sampleconf/mimeconf
@@ -70,6 +70,7 @@ application/vnd.sun.xml.writer.template = exec rclsoff
application/vnd.wordperfect = exec wpd2html;mimetype=text/html
application/x-abiword = exec rclabw
application/x-awk = internal text/plain
+application/x-chm = execm rclchm
application/x-dvi = exec rcldvi
application/x-flac = execm rclaudio
application/x-gnuinfo = execm rclinfo
@@ -77,10 +78,10 @@ application/x-kword = exec rclkwd
application/x-lyx = exec rcllyx
application/x-mimehtml = internal message/rfc822
application/x-perl = internal text/plain
+application/x-rar = execm rclrar
application/x-scribus = exec rclscribus
application/x-shellscript = internal text/plain
application/x-tex = exec rcltex
-application/x-chm = execm rclchm
application/x-webarchive = execm rclwar
application/zip = execm rclzip;charset=default
audio/mpeg = execm rclaudio
@@ -269,4 +270,5 @@ other = application/vnd.sun.xml.draw \
application/vnd.sun.xml.draw.template \
application/vnd.sun.xml.math \
application/x-fsdirectory \
- application/zip
+ application/x-rar \
+ application/zip \
diff --git a/src/sampleconf/mimemap b/src/sampleconf/mimemap
index 8c05b807..465abec1 100644
--- a/src/sampleconf/mimemap
+++ b/src/sampleconf/mimemap
@@ -44,6 +44,7 @@
.gz = application/x-gzip
.Z = application/x-gzip
.bz2 = application/x-bzip2
+.rar = application/x-rar
#.Z = application/x-compress
.zip = application/zip
diff --git a/website/features.html b/website/features.html
index 1c08be59..50cf5fe2 100644
--- a/website/features.html
+++ b/website/features.html
@@ -135,6 +135,12 @@
Zip archives (needs Python).
+ Rar archives (needs Python), the
+ rarfile Python
+ module and the unrar utility.
+
iCalendar(.ics) files
(needs Python, icalendar).