mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-18 07:15:13 -05:00
194 lines
14 KiB
HTML
194 lines
14 KiB
HTML
|
|
||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<html><head><title>Python: package UnRAR2</title>
|
||
|
</head><body bgcolor="#f0f0f8">
|
||
|
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
||
|
<tr bgcolor="#7799ee">
|
||
|
<td valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>UnRAR2</strong></big></big> (version 0.99.2)</font></td
|
||
|
><td align=right valign=bottom
|
||
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/rainman/dev/py-unrar2/UnRAR2/__init__.py">/home/rainman/dev/py-unrar2/UnRAR2/__init__.py</a></font></td></tr></table>
|
||
|
<p><tt>pyUnRAR2 is a ctypes based wrapper around the free UnRAR.dll. <br>
|
||
|
<br>
|
||
|
It is an modified version of Jimmy Retzlaff's pyUnRAR - more simple,<br>
|
||
|
stable and foolproof.<br>
|
||
|
Notice that it has INCOMPATIBLE interface.<br>
|
||
|
<br>
|
||
|
It enables reading and unpacking of archives created with the<br>
|
||
|
RAR/WinRAR archivers. There is a low-level interface which is very<br>
|
||
|
similar to the C interface provided by UnRAR. There is also a<br>
|
||
|
higher level interface which makes some common operations easier.</tt></p>
|
||
|
<p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#aa55cc">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="UnRAR2.UnRAR2.html"><strong>UnRAR2</strong> (package)</a><br>
|
||
|
<a href="UnRAR2.rar_exceptions.html">rar_exceptions</a><br>
|
||
|
</td><td width="25%" valign=top><a href="UnRAR2.setup.html">setup</a><br>
|
||
|
<a href="UnRAR2.test_UnRAR2.html">test_UnRAR2</a><br>
|
||
|
</td><td width="25%" valign=top><a href="UnRAR2.unix.html">unix</a><br>
|
||
|
<a href="UnRAR2.windows.html">windows</a><br>
|
||
|
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ee77aa">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><dl>
|
||
|
<dt><font face="helvetica, arial"><a href="UnRAR2.unix.html#RarFileImplementation">UnRAR2.unix.RarFileImplementation</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
|
||
|
</font></dt><dd>
|
||
|
<dl>
|
||
|
<dt><font face="helvetica, arial"><a href="UnRAR2.html#RarFile">RarFile</a>
|
||
|
</font></dt></dl>
|
||
|
</dd>
|
||
|
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
|
||
|
</font></dt><dd>
|
||
|
<dl>
|
||
|
<dt><font face="helvetica, arial"><a href="UnRAR2.html#RarInfo">RarInfo</a>
|
||
|
</font></dt></dl>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ffc8d8">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#000000" face="helvetica, arial"><a name="RarFile">class <strong>RarFile</strong></a>(<a href="UnRAR2.unix.html#RarFileImplementation">UnRAR2.unix.RarFileImplementation</a>)</font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
||
|
<dd><a href="UnRAR2.html#RarFile">RarFile</a></dd>
|
||
|
<dd><a href="UnRAR2.unix.html#RarFileImplementation">UnRAR2.unix.RarFileImplementation</a></dd>
|
||
|
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
|
||
|
</dl>
|
||
|
<hr>
|
||
|
Methods defined here:<br>
|
||
|
<dl><dt><a name="RarFile-__del__"><strong>__del__</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-__init__"><strong>__init__</strong></a>(self, archiveName, password<font color="#909090">=None</font>)</dt><dd><tt>Instantiate the archive.<br>
|
||
|
<br>
|
||
|
archiveName is the name of the RAR file.<br>
|
||
|
password is used to decrypt the files in the archive.<br>
|
||
|
<br>
|
||
|
Properties:<br>
|
||
|
comment - comment associated with the archive<br>
|
||
|
<br>
|
||
|
>>> print <a href="#RarFile">RarFile</a>('test.rar').comment<br>
|
||
|
This is a test.</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-extract"><strong>extract</strong></a>(self, condition<font color="#909090">='*'</font>, path<font color="#909090">='.'</font>, withSubpath<font color="#909090">=True</font>, overwrite<font color="#909090">=True</font>)</dt><dd><tt>Extract specific files from archive to disk.<br>
|
||
|
<br>
|
||
|
If "condition" is a list of numbers, then extract files which have those positions in infolist.<br>
|
||
|
If "condition" is a string, then it is treated as a wildcard for names of files to extract.<br>
|
||
|
If "condition" is a function, it is treated as a callback function, which accepts a <a href="#RarInfo">RarInfo</a> <a href="__builtin__.html#object">object</a><br>
|
||
|
and returns either boolean True (extract) or boolean False (skip).<br>
|
||
|
DEPRECATED: If "condition" callback returns string (only supported for Windows) - <br>
|
||
|
that string will be used as a new name to save the file under.<br>
|
||
|
If "condition" is omitted, all files are extracted.<br>
|
||
|
<br>
|
||
|
"path" is a directory to extract to<br>
|
||
|
"withSubpath" flag denotes whether files are extracted with their full path in the archive.<br>
|
||
|
"overwrite" flag denotes whether extracted files will overwrite old ones. Defaults to true.<br>
|
||
|
<br>
|
||
|
Returns list of RarInfos for extracted files.</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-infoiter"><strong>infoiter</strong></a>(self)</dt><dd><tt>Iterate over all the files in the archive, generating RarInfos.<br>
|
||
|
<br>
|
||
|
>>> import os<br>
|
||
|
>>> for fileInArchive in <a href="#RarFile">RarFile</a>('test.rar').<a href="#RarFile-infoiter">infoiter</a>():<br>
|
||
|
... print os.path.split(fileInArchive.filename)[-1],<br>
|
||
|
... print fileInArchive.isdir,<br>
|
||
|
... print fileInArchive.size,<br>
|
||
|
... print fileInArchive.comment,<br>
|
||
|
... print tuple(fileInArchive.datetime)[0:5],<br>
|
||
|
... print time.strftime('%a, %d %b %Y %H:%M', fileInArchive.datetime)<br>
|
||
|
test True 0 None (2003, 6, 30, 1, 59) Mon, 30 Jun 2003 01:59<br>
|
||
|
test.txt False 20 None (2003, 6, 30, 2, 1) Mon, 30 Jun 2003 02:01<br>
|
||
|
this.py False 1030 None (2002, 2, 8, 16, 47) Fri, 08 Feb 2002 16:47</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-infolist"><strong>infolist</strong></a>(self)</dt><dd><tt>Return a list of RarInfos, descripting the contents of the archive.</tt></dd></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-read_files"><strong>read_files</strong></a>(self, condition<font color="#909090">='*'</font>)</dt><dd><tt>Read specific files from archive into memory.<br>
|
||
|
If "condition" is a list of numbers, then return files which have those positions in infolist.<br>
|
||
|
If "condition" is a string, then it is treated as a wildcard for names of files to extract.<br>
|
||
|
If "condition" is a function, it is treated as a callback function, which accepts a <a href="#RarInfo">RarInfo</a> <a href="__builtin__.html#object">object</a> <br>
|
||
|
and returns boolean True (extract) or False (skip).<br>
|
||
|
If "condition" is omitted, all files are returned.<br>
|
||
|
<br>
|
||
|
Returns list of tuples (<a href="#RarInfo">RarInfo</a> info, str contents)</tt></dd></dl>
|
||
|
|
||
|
<hr>
|
||
|
Methods inherited from <a href="UnRAR2.unix.html#RarFileImplementation">UnRAR2.unix.RarFileImplementation</a>:<br>
|
||
|
<dl><dt><a name="RarFile-call"><strong>call</strong></a>(self, cmd, options<font color="#909090">=[]</font>, files<font color="#909090">=[]</font>)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-destruct"><strong>destruct</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-escaped_password"><strong>escaped_password</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="RarFile-init"><strong>init</strong></a>(self, password<font color="#909090">=None</font>)</dt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Data descriptors inherited from <a href="UnRAR2.unix.html#RarFileImplementation">UnRAR2.unix.RarFileImplementation</a>:<br>
|
||
|
<dl><dt><strong>__dict__</strong></dt>
|
||
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
||
|
</dl>
|
||
|
<dl><dt><strong>__weakref__</strong></dt>
|
||
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
||
|
</dl>
|
||
|
</td></tr></table> <p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#ffc8d8">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#000000" face="helvetica, arial"><a name="RarInfo">class <strong>RarInfo</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
|
||
|
|
||
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
||
|
<td colspan=2><tt>Represents a file header in an archive. Don't instantiate directly.<br>
|
||
|
Use only to obtain information about file.<br>
|
||
|
YOU CANNOT EXTRACT FILE CONTENTS USING THIS OBJECT.<br>
|
||
|
USE METHODS OF <a href="#RarFile">RarFile</a> CLASS INSTEAD.<br>
|
||
|
<br>
|
||
|
Properties:<br>
|
||
|
index - index of file within the archive<br>
|
||
|
filename - name of the file in the archive including path (if any)<br>
|
||
|
datetime - file date/time as a struct_time suitable for time.strftime<br>
|
||
|
isdir - True if the file is a directory<br>
|
||
|
size - size in bytes of the uncompressed file<br>
|
||
|
comment - comment associated with the file<br>
|
||
|
<br>
|
||
|
Note - this is not currently intended to be a Python file-like <a href="__builtin__.html#object">object</a>.<br> </tt></td></tr>
|
||
|
<tr><td> </td>
|
||
|
<td width="100%">Methods defined here:<br>
|
||
|
<dl><dt><a name="RarInfo-__init__"><strong>__init__</strong></a>(self, rarfile, data)</dt></dl>
|
||
|
|
||
|
<dl><dt><a name="RarInfo-__str__"><strong>__str__</strong></a>(self)</dt></dl>
|
||
|
|
||
|
<hr>
|
||
|
Data descriptors defined here:<br>
|
||
|
<dl><dt><strong>__dict__</strong></dt>
|
||
|
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
|
||
|
</dl>
|
||
|
<dl><dt><strong>__weakref__</strong></dt>
|
||
|
<dd><tt>list of weak references to the object (if defined)</tt></dd>
|
||
|
</dl>
|
||
|
</td></tr></table></td></tr></table><p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#eeaa77">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><dl><dt><a name="-condition2checker"><strong>condition2checker</strong></a>(condition)</dt><dd><tt>Converts different condition types to callback</tt></dd></dl>
|
||
|
</td></tr></table><p>
|
||
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
||
|
<tr bgcolor="#55aa55">
|
||
|
<td colspan=3 valign=bottom> <br>
|
||
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
||
|
|
||
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
||
|
<td width="100%"><strong>__version__</strong> = '0.99.2'<br>
|
||
|
<strong>in_windows</strong> = False</td></tr></table>
|
||
|
</body></html>
|