From Peter.Kelemen@gmail.com Fri Sep 19 18:51:00 2008
Return-Path: <Peter.Kelemen@gmail.com>
Date: Sat, 20 Sep 2008 00:51:17 +0200
From: KELEMEN Peter <Peter.Kelemen@gmail.com>
To: Brett Smith <brettcsmith@brettcsmith.org>
Subject: [PATCH] dtrx: RAR support
Message-ID: <20080919225117.GA993@kaylee>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.17+20080114 (2008-01-14)
Status: RO
X-Status: A
Content-Length: 1589
Lines: 48

Brett,

The following patch adds RAR support for dtrx.

HTH,
Peter

diff -r ececf7836546 scripts/dtrx
--- a/scripts/dtrx	Tue Sep 16 21:51:59 2008 -0400
+++ b/scripts/dtrx	Sat Sep 20 00:50:16 2008 +0200
@@ -515,6 +515,25 @@ class ShieldExtractor(NoPipeExtractor):
         return result
 
 
+class RarExtractor(NoPipeExtractor):
+    file_type = 'RAR archive'
+    extract_command = ['unrar', 'x']
+    list_command = ['unrar', 'l']
+    border_re = re.compile('^-+$')
+
+    def get_filenames(self):
+        inside = False
+        for line in NoPipeExtractor.get_filenames(self):
+            if self.border_re.match(line):
+                if inside:
+                    break
+                else:
+                    inside = True
+            elif inside:
+                yield line.split(' ')[1]
+        self.archive.close()
+
+
 class BaseHandler(object):
     def __init__(self, extractor, options):
         self.extractor = extractor
@@ -775,6 +794,10 @@ class ExtractorBuilder(object):
                              'mimetypes': ('x-cab',),
                              'extensions': ('cab',),
                              'magic': ('Microsoft Cabinet Archive',)},
+                     'rar': {'extractor': RarExtractor,
+                             'mimetypes': ('rar',),
+                             'extensions': ('rar'),
+                             'magic': ('RAR archive')},
                      'shield': {'extractor': ShieldExtractor,
                                 'mimetypes': ('x-cab',),
                                 'extensions': ('cab', 'hdr'),


From Peter.Kelemen@gmail.com Wed Sep 24 09:42:18 2008
X-Original-To: me@brettcsmith.org
Date: Wed, 24 Sep 2008 15:31:18 +0200
From: KELEMEN Peter <Peter.Kelemen@gmail.com>
To: Brett Smith <me@brettcsmith.org>
Subject: Re: [PATCH] dtrx: RAR support
Message-ID: <20080924133118.GG8943@kyra>
References: <20080919225117.GA993@kaylee> <20080921180522.GB15446@canonical.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20080921180522.GB15446@canonical.org>
User-Agent: Mutt/1.5.17+20080114 (2008-01-14)
Status: RO
Content-Length: 684
Lines: 25

* Brett Smith (me@brettcsmith.org) [20080921 14:05]:

> Thanks very much for this; it looks great.

You're welcome.

> Can you please confirm for me that it's licensed under GPLv3 or
> any later version?  A simple "yes" will do.  :)

Sure, GPLv3 is OK.

> Also, do you want me to add any copyright notice(s) for your
> contribution?

I'm ambivalent, I trust your judgement.  Should you choose to do
so, please use my Peter.Kelemen@gmail.com address.

Thanks,
Peter

-- 
    .+'''+.         .+'''+.         .+'''+.         .+'''+.         .+''
 Kelemen PÃ©ter     /       \       /       \     Peter.Kelemen@gmail.com
.+'         `+...+'         `+...+'         `+...+'         `+...+'


From - Thu Dec 01 18:53:16 2011
Return-Path: <ville.skytta@iki.fi>
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on llewellyn
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS
	autolearn=ham version=3.3.1
X-Original-To: me@brettcsmith.org
Delivered-To: me@brettcsmith.org
Received: from filtteri1.pp.htv.fi (filtteri1.pp.htv.fi [213.243.153.184])
	by brettcsmith.org (Postfix) with ESMTP id A51BA67A6
	for <me@brettcsmith.org>; Thu,  1 Dec 2011 02:22:59 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
	by filtteri1.pp.htv.fi (Postfix) with ESMTP id CC02018B3AA
	for <me@brettcsmith.org>; Thu,  1 Dec 2011 09:22:58 +0200 (EET)
X-Virus-Scanned: Debian amavisd-new at pp.htv.fi
Received: from smtp5.welho.com ([213.243.153.39])
	by localhost (filtteri1.pp.htv.fi [213.243.153.184]) (amavisd-new, port 10024)
	with ESMTP id nX7Bob2-Ku0p for <me@brettcsmith.org>;
	Thu,  1 Dec 2011 09:22:56 +0200 (EET)
Received: from viper.bobcat.mine.nu (cs181085020.pp.htv.fi [82.181.85.20])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp5.welho.com (Postfix) with ESMTPS id 50F675BC002
	for <me@brettcsmith.org>; Thu,  1 Dec 2011 09:22:56 +0200 (EET)
Message-ID: <4ED72B50.60000@iki.fi>
Date: Thu, 01 Dec 2011 09:22:56 +0200
From: =?ISO-8859-1?Q?Ville_Skytt=E4?= <ville.skytta@iki.fi>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16
MIME-Version: 1.0
To: Brett Smith <me@brettcsmith.org>
Subject: Re: [PATCH 0 of 3] Some trivial dtrx patches
References: <patchbomb.1322320204@viper.bobcat.mine.nu> <4ED459D2.4090703@brettcsmith.org> <4ED52917.900@iki.fi> <4ED5B081.4040505@brettcsmith.org> <4ED68074.70500@iki.fi> <4ED6C398.8050101@brettcsmith.org>
In-Reply-To: <4ED6C398.8050101@brettcsmith.org>
X-Enigmail-Version: 1.1.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

On 12/01/2011 02:00 AM, Brett Smith wrote:
> On 11/30/2011 02:13 PM, Ville Skyttä wrote:
>> BTW, you mentioned earlier that you were applying some of my initial
>> trival patches but I don't see them in the public hg repo yet, did you
>> find a problem with them?
> 
> No, no problem.  That's really weird -- they started showing up at 
> <http://brettcsmith.org/2007/dtrx/dtrx/> as soon as I pushed them, and 
> when I clone that repository with hg they show up in the log too.  How 
> are you checking this?

hg pull -u.  But I see the two first ones are indeed in the repository,
so it's possible that I've managed to mess up something locally.  No
problem, I'll probably just throw away my earlier clone.

> I'm happy with the second round of patches too, but I meant to ask 
> before I apply them: since they're more substantive, can I go ahead and 
> add your copyright line to the source code?  And can you please just 
> confirm that you're okay with this code being distributed under GPLv3 or 
> later?

Yes, go ahead, and GPLv3+ is fine.  (That means that I may need to
switch from GPLv2+ to GPLv3+ for some other utilities I have that may be
using dtrx in the future, but that shouldn't be a problem.)


