1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-14 20:12:19 -05:00
SickRage/lib/unrar2/UnRAR2.html

194 lines
14 KiB
HTML
Raw Normal View History

<!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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<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&nbsp;is&nbsp;a&nbsp;ctypes&nbsp;based&nbsp;wrapper&nbsp;around&nbsp;the&nbsp;free&nbsp;UnRAR.dll.&nbsp;<br>
&nbsp;<br>
It&nbsp;is&nbsp;an&nbsp;modified&nbsp;version&nbsp;of&nbsp;Jimmy&nbsp;Retzlaff's&nbsp;pyUnRAR&nbsp;-&nbsp;more&nbsp;simple,<br>
stable&nbsp;and&nbsp;foolproof.<br>
Notice&nbsp;that&nbsp;it&nbsp;has&nbsp;INCOMPATIBLE&nbsp;interface.<br>
&nbsp;<br>
It&nbsp;enables&nbsp;reading&nbsp;and&nbsp;unpacking&nbsp;of&nbsp;archives&nbsp;created&nbsp;with&nbsp;the<br>
RAR/WinRAR&nbsp;archivers.&nbsp;There&nbsp;is&nbsp;a&nbsp;low-level&nbsp;interface&nbsp;which&nbsp;is&nbsp;very<br>
similar&nbsp;to&nbsp;the&nbsp;C&nbsp;interface&nbsp;provided&nbsp;by&nbsp;UnRAR.&nbsp;There&nbsp;is&nbsp;also&nbsp;a<br>
higher&nbsp;level&nbsp;interface&nbsp;which&nbsp;makes&nbsp;some&nbsp;common&nbsp;operations&nbsp;easier.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="UnRAR2.UnRAR2.html"><strong>UnRAR2</strong>&nbsp;(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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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&nbsp;the&nbsp;archive.<br>
&nbsp;<br>
archiveName&nbsp;is&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;RAR&nbsp;file.<br>
password&nbsp;is&nbsp;used&nbsp;to&nbsp;decrypt&nbsp;the&nbsp;files&nbsp;in&nbsp;the&nbsp;archive.<br>
&nbsp;<br>
Properties:<br>
&nbsp;&nbsp;&nbsp;&nbsp;comment&nbsp;-&nbsp;comment&nbsp;associated&nbsp;with&nbsp;the&nbsp;archive<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;print&nbsp;<a href="#RarFile">RarFile</a>('test.rar').comment<br>
This&nbsp;is&nbsp;a&nbsp;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&nbsp;specific&nbsp;files&nbsp;from&nbsp;archive&nbsp;to&nbsp;disk.<br>
&nbsp;<br>
If&nbsp;"condition"&nbsp;is&nbsp;a&nbsp;list&nbsp;of&nbsp;numbers,&nbsp;then&nbsp;extract&nbsp;files&nbsp;which&nbsp;have&nbsp;those&nbsp;positions&nbsp;in&nbsp;infolist.<br>
If&nbsp;"condition"&nbsp;is&nbsp;a&nbsp;string,&nbsp;then&nbsp;it&nbsp;is&nbsp;treated&nbsp;as&nbsp;a&nbsp;wildcard&nbsp;for&nbsp;names&nbsp;of&nbsp;files&nbsp;to&nbsp;extract.<br>
If&nbsp;"condition"&nbsp;is&nbsp;a&nbsp;function,&nbsp;it&nbsp;is&nbsp;treated&nbsp;as&nbsp;a&nbsp;callback&nbsp;function,&nbsp;which&nbsp;accepts&nbsp;a&nbsp;<a href="#RarInfo">RarInfo</a>&nbsp;<a href="__builtin__.html#object">object</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;returns&nbsp;either&nbsp;boolean&nbsp;True&nbsp;(extract)&nbsp;or&nbsp;boolean&nbsp;False&nbsp;(skip).<br>
DEPRECATED:&nbsp;If&nbsp;"condition"&nbsp;callback&nbsp;returns&nbsp;string&nbsp;(only&nbsp;supported&nbsp;for&nbsp;Windows)&nbsp;-&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;that&nbsp;string&nbsp;will&nbsp;be&nbsp;used&nbsp;as&nbsp;a&nbsp;new&nbsp;name&nbsp;to&nbsp;save&nbsp;the&nbsp;file&nbsp;under.<br>
If&nbsp;"condition"&nbsp;is&nbsp;omitted,&nbsp;all&nbsp;files&nbsp;are&nbsp;extracted.<br>
&nbsp;<br>
"path"&nbsp;is&nbsp;a&nbsp;directory&nbsp;to&nbsp;extract&nbsp;to<br>
"withSubpath"&nbsp;flag&nbsp;denotes&nbsp;whether&nbsp;files&nbsp;are&nbsp;extracted&nbsp;with&nbsp;their&nbsp;full&nbsp;path&nbsp;in&nbsp;the&nbsp;archive.<br>
"overwrite"&nbsp;flag&nbsp;denotes&nbsp;whether&nbsp;extracted&nbsp;files&nbsp;will&nbsp;overwrite&nbsp;old&nbsp;ones.&nbsp;Defaults&nbsp;to&nbsp;true.<br>
&nbsp;<br>
Returns&nbsp;list&nbsp;of&nbsp;RarInfos&nbsp;for&nbsp;extracted&nbsp;files.</tt></dd></dl>
<dl><dt><a name="RarFile-infoiter"><strong>infoiter</strong></a>(self)</dt><dd><tt>Iterate&nbsp;over&nbsp;all&nbsp;the&nbsp;files&nbsp;in&nbsp;the&nbsp;archive,&nbsp;generating&nbsp;RarInfos.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;import&nbsp;os<br>
&gt;&gt;&gt;&nbsp;for&nbsp;fileInArchive&nbsp;in&nbsp;<a href="#RarFile">RarFile</a>('test.rar').<a href="#RarFile-infoiter">infoiter</a>():<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;os.path.split(fileInArchive.filename)[-1],<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;fileInArchive.isdir,<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;fileInArchive.size,<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;fileInArchive.comment,<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;tuple(fileInArchive.datetime)[0:5],<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;time.strftime('%a,&nbsp;%d&nbsp;%b&nbsp;%Y&nbsp;%H:%M',&nbsp;fileInArchive.datetime)<br>
test&nbsp;True&nbsp;0&nbsp;None&nbsp;(2003,&nbsp;6,&nbsp;30,&nbsp;1,&nbsp;59)&nbsp;Mon,&nbsp;30&nbsp;Jun&nbsp;2003&nbsp;01:59<br>
test.txt&nbsp;False&nbsp;20&nbsp;None&nbsp;(2003,&nbsp;6,&nbsp;30,&nbsp;2,&nbsp;1)&nbsp;Mon,&nbsp;30&nbsp;Jun&nbsp;2003&nbsp;02:01<br>
this.py&nbsp;False&nbsp;1030&nbsp;None&nbsp;(2002,&nbsp;2,&nbsp;8,&nbsp;16,&nbsp;47)&nbsp;Fri,&nbsp;08&nbsp;Feb&nbsp;2002&nbsp;16:47</tt></dd></dl>
<dl><dt><a name="RarFile-infolist"><strong>infolist</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;list&nbsp;of&nbsp;RarInfos,&nbsp;descripting&nbsp;the&nbsp;contents&nbsp;of&nbsp;the&nbsp;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&nbsp;specific&nbsp;files&nbsp;from&nbsp;archive&nbsp;into&nbsp;memory.<br>
If&nbsp;"condition"&nbsp;is&nbsp;a&nbsp;list&nbsp;of&nbsp;numbers,&nbsp;then&nbsp;return&nbsp;files&nbsp;which&nbsp;have&nbsp;those&nbsp;positions&nbsp;in&nbsp;infolist.<br>
If&nbsp;"condition"&nbsp;is&nbsp;a&nbsp;string,&nbsp;then&nbsp;it&nbsp;is&nbsp;treated&nbsp;as&nbsp;a&nbsp;wildcard&nbsp;for&nbsp;names&nbsp;of&nbsp;files&nbsp;to&nbsp;extract.<br>
If&nbsp;"condition"&nbsp;is&nbsp;a&nbsp;function,&nbsp;it&nbsp;is&nbsp;treated&nbsp;as&nbsp;a&nbsp;callback&nbsp;function,&nbsp;which&nbsp;accepts&nbsp;a&nbsp;<a href="#RarInfo">RarInfo</a>&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;returns&nbsp;boolean&nbsp;True&nbsp;(extract)&nbsp;or&nbsp;False&nbsp;(skip).<br>
If&nbsp;"condition"&nbsp;is&nbsp;omitted,&nbsp;all&nbsp;files&nbsp;are&nbsp;returned.<br>
&nbsp;<br>
Returns&nbsp;list&nbsp;of&nbsp;tuples&nbsp;(<a href="#RarInfo">RarInfo</a>&nbsp;info,&nbsp;str&nbsp;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&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Represents&nbsp;a&nbsp;file&nbsp;header&nbsp;in&nbsp;an&nbsp;archive.&nbsp;Don't&nbsp;instantiate&nbsp;directly.<br>
Use&nbsp;only&nbsp;to&nbsp;obtain&nbsp;information&nbsp;about&nbsp;file.<br>
YOU&nbsp;CANNOT&nbsp;EXTRACT&nbsp;FILE&nbsp;CONTENTS&nbsp;USING&nbsp;THIS&nbsp;OBJECT.<br>
USE&nbsp;METHODS&nbsp;OF&nbsp;<a href="#RarFile">RarFile</a>&nbsp;CLASS&nbsp;INSTEAD.<br>
&nbsp;<br>
Properties:<br>
&nbsp;&nbsp;&nbsp;&nbsp;index&nbsp;-&nbsp;index&nbsp;of&nbsp;file&nbsp;within&nbsp;the&nbsp;archive<br>
&nbsp;&nbsp;&nbsp;&nbsp;filename&nbsp;-&nbsp;name&nbsp;of&nbsp;the&nbsp;file&nbsp;in&nbsp;the&nbsp;archive&nbsp;including&nbsp;path&nbsp;(if&nbsp;any)<br>
&nbsp;&nbsp;&nbsp;&nbsp;datetime&nbsp;-&nbsp;file&nbsp;date/time&nbsp;as&nbsp;a&nbsp;struct_time&nbsp;suitable&nbsp;for&nbsp;time.strftime<br>
&nbsp;&nbsp;&nbsp;&nbsp;isdir&nbsp;-&nbsp;True&nbsp;if&nbsp;the&nbsp;file&nbsp;is&nbsp;a&nbsp;directory<br>
&nbsp;&nbsp;&nbsp;&nbsp;size&nbsp;-&nbsp;size&nbsp;in&nbsp;bytes&nbsp;of&nbsp;the&nbsp;uncompressed&nbsp;file<br>
&nbsp;&nbsp;&nbsp;&nbsp;comment&nbsp;-&nbsp;comment&nbsp;associated&nbsp;with&nbsp;the&nbsp;file<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
Note&nbsp;-&nbsp;this&nbsp;is&nbsp;not&nbsp;currently&nbsp;intended&nbsp;to&nbsp;be&nbsp;a&nbsp;Python&nbsp;file-like&nbsp;<a href="__builtin__.html#object">object</a>.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</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&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-condition2checker"><strong>condition2checker</strong></a>(condition)</dt><dd><tt>Converts&nbsp;different&nbsp;condition&nbsp;types&nbsp;to&nbsp;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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__version__</strong> = '0.99.2'<br>
<strong>in_windows</strong> = False</td></tr></table>
</body></html>