Sun, 12 Apr 2009 11:21:51 -0400
Start printing results ASAP with -l or -t.
Doing -l on a large archive was painful because dtrx would wait until it
had all the listings before it displayed any. It did this to make sure
that the listing would be successful.
On reconsidering, though, I think it's really unlikely that there'll be a
case where a lister process provides *some* good output for a given file in
the wrong format. So, now -l will try to get one good line out of the
lister. If it gets that, then it will immediately start displaying results
as they come in. On the off chance that it detects an error later on, it
will display an error about that, and then try again with a different
extractor if appropriate.
92
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
1 | From Peter.Kelemen@gmail.com Fri Sep 19 18:51:00 2008 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
2 | Return-Path: <Peter.Kelemen@gmail.com> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
3 | Date: Sat, 20 Sep 2008 00:51:17 +0200 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
4 | From: KELEMEN Peter <Peter.Kelemen@gmail.com> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
5 | To: Brett Smith <brettcsmith@brettcsmith.org> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
6 | Subject: [PATCH] dtrx: RAR support |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
7 | Message-ID: <20080919225117.GA993@kaylee> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
8 | MIME-Version: 1.0 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
9 | Content-Type: text/plain; charset=us-ascii |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
10 | Content-Disposition: inline |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
11 | User-Agent: Mutt/1.5.17+20080114 (2008-01-14) |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
12 | Status: RO |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
13 | X-Status: A |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
14 | Content-Length: 1589 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
15 | Lines: 48 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
16 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
17 | Brett, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
18 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
19 | The following patch adds RAR support for dtrx. |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
20 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
21 | HTH, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
22 | Peter |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
23 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
24 | diff -r ececf7836546 scripts/dtrx |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
25 | --- a/scripts/dtrx Tue Sep 16 21:51:59 2008 -0400 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
26 | +++ b/scripts/dtrx Sat Sep 20 00:50:16 2008 +0200 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
27 | @@ -515,6 +515,25 @@ class ShieldExtractor(NoPipeExtractor): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
28 | return result |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
29 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
30 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
31 | +class RarExtractor(NoPipeExtractor): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
32 | + file_type = 'RAR archive' |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
33 | + extract_command = ['unrar', 'x'] |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
34 | + list_command = ['unrar', 'l'] |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
35 | + border_re = re.compile('^-+$') |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
36 | + |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
37 | + def get_filenames(self): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
38 | + inside = False |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
39 | + for line in NoPipeExtractor.get_filenames(self): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
40 | + if self.border_re.match(line): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
41 | + if inside: |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
42 | + break |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
43 | + else: |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
44 | + inside = True |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
45 | + elif inside: |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
46 | + yield line.split(' ')[1] |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
47 | + self.archive.close() |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
48 | + |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
49 | + |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
50 | class BaseHandler(object): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
51 | def __init__(self, extractor, options): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
52 | self.extractor = extractor |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
53 | @@ -775,6 +794,10 @@ class ExtractorBuilder(object): |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
54 | 'mimetypes': ('x-cab',), |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
55 | 'extensions': ('cab',), |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
56 | 'magic': ('Microsoft Cabinet Archive',)}, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
57 | + 'rar': {'extractor': RarExtractor, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
58 | + 'mimetypes': ('rar',), |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
59 | + 'extensions': ('rar'), |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
60 | + 'magic': ('RAR archive')}, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
61 | 'shield': {'extractor': ShieldExtractor, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
62 | 'mimetypes': ('x-cab',), |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
63 | 'extensions': ('cab', 'hdr'), |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
64 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
65 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
66 | From Peter.Kelemen@gmail.com Wed Sep 24 09:42:18 2008 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
67 | X-Original-To: me@brettcsmith.org |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
68 | Date: Wed, 24 Sep 2008 15:31:18 +0200 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
69 | From: KELEMEN Peter <Peter.Kelemen@gmail.com> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
70 | To: Brett Smith <me@brettcsmith.org> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
71 | Subject: Re: [PATCH] dtrx: RAR support |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
72 | Message-ID: <20080924133118.GG8943@kyra> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
73 | References: <20080919225117.GA993@kaylee> <20080921180522.GB15446@canonical.org> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
74 | MIME-Version: 1.0 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
75 | Content-Type: text/plain; charset=utf-8 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
76 | Content-Disposition: inline |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
77 | Content-Transfer-Encoding: 8bit |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
78 | In-Reply-To: <20080921180522.GB15446@canonical.org> |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
79 | User-Agent: Mutt/1.5.17+20080114 (2008-01-14) |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
80 | Status: RO |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
81 | Content-Length: 684 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
82 | Lines: 25 |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
83 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
84 | * Brett Smith (me@brettcsmith.org) [20080921 14:05]: |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
85 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
86 | > Thanks very much for this; it looks great. |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
87 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
88 | You're welcome. |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
89 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
90 | > Can you please confirm for me that it's licensed under GPLv3 or |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
91 | > any later version? A simple "yes" will do. :) |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
92 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
93 | Sure, GPLv3 is OK. |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
94 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
95 | > Also, do you want me to add any copyright notice(s) for your |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
96 | > contribution? |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
97 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
98 | I'm ambivalent, I trust your judgement. Should you choose to do |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
99 | so, please use my Peter.Kelemen@gmail.com address. |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
100 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
101 | Thanks, |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
102 | Peter |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
103 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
104 | -- |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
105 | .+'''+. .+'''+. .+'''+. .+'''+. .+'' |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
106 | Kelemen Péter / \ / \ Peter.Kelemen@gmail.com |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
107 | .+' `+...+' `+...+' `+...+' `+...+' |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
108 | |
d9319958bb5a
Add RAR support. Thanks to Peter Kelemen for the patch.
Brett Smith <brettcsmith@brettcsmith.org>
parents:
diff
changeset
|
109 |