All pastes #473607 Raw Edit

Aji

public text v1 · immutable
·published 2007-05-06 10:23 UTC
rendered paste body
--- Hellanzb/Core.py.orig       Tue Mar 27 04:20:43 2007
+++ Hellanzb/Core.py    Tue May  1 03:54:18 2007
@@ -125,6 +125,8 @@
             Hellanzb.NZB_ZIPS = '.nzb.zip'
         if not hasattr(Hellanzb, 'NZB_GZIPS'):
             Hellanzb.NZB_GZIPS = '.nzb.gz'
+        if not hasattr(Hellanzb, 'NZB_RARS'):
+            Hellanzb.NZB_RARS = '.rar'

         if not hasattr(Hellanzb, 'DISABLE_COLORS'):
             Hellanzb.DISABLE_COLORS = False
--- Hellanzb/NZBQueue.py.orig   Tue Mar 27 04:20:43 2007
+++ Hellanzb/NZBQueue.py        Sun May  6 08:07:25 2007
@@ -155,7 +155,7 @@
                 queuedMap.pop(os.path.normpath(os.path.join(Hellanzb.QUEUE_DIR, file)))

         elif isOldEnough(os.path.join(Hellanzb.QUEUE_DIR, file)):
-            if not nzbZipSearch(file) and not nzbGzipSearch(file):
+            if not nzbZipSearch(file) and not nzbGzipSearch(file) and not nzbRarSearch(file):
                 Hellanzb.queueDirIgnore.append(file)

     # Remove anything no longer in the queue directory
@@ -309,6 +309,42 @@

     z.close()
     os.remove(filepath)
+    return True
+
+def nzbRarSearch(file):
+    """ Should extract NZBs from the specified file in Hellanzb.QUEUE_DIR when
+    it appears to be a .gz file (according to the Hellanzb.NZB_RARS suffix)
+    """
+    if not Hellanzb.NZB_RARS or not file.lower().endswith(Hellanzb.NZB_RARS):
+        return False
+
+    fileName = os.path.join(Hellanzb.QUEUE_DIR, file)
+
+    pathToExtract = Hellanzb.QUEUE_DIR
+
+    cmd = Hellanzb.UNRAR_CMD + ' e ' + fileName + ' '+ pathToExtract
+    try:
+        returnCode = os.system(cmd)
+    except SystemExit:
+        # Rename the renamed files
+        for orig, renamed in renamedFiles.iteritems():
+            move(renamed, orig)
+        raise
+
+    if returnCode > 0:
+        errMsg = 'There was a problem during ' + cmd
+        raise FatalError(errMsg)
+
+    cmd = 'rm ' + fileName
+    try:
+        returnCode = os.system(cmd)
+    except SystemExit:
+        raise
+
+    if returnCode > 0:
+        errMsg = 'There was a problem during ' + cmd
+        raise FatalError(errMsg)
+
     return True

 def sortQueueFromRecoveredState(queuedRecoveredState):
--- setup.py.orig       Mon Feb 19 18:12:55 2007
+++ setup.py    Wed Feb 21 16:34:28 2007
@@ -38,8 +38,7 @@
         packages = [ 'Hellanzb', 'Hellanzb.NZBLeecher', 'Hellanzb.HellaXMLRPC',
                      'Hellanzb.external', 'Hellanzb.external.elementtree' ],
         scripts = [ 'hellanzb.py' ],
-        data_files = [ ( 'etc', [ 'etc/hellanzb.conf.sample' ] ),
-                       ( 'share/doc/hellanzb', [ 'CHANGELOG', 'CREDITS', 'README', 'LICENSE' ] ) ],
+        data_files = [ ( 'etc', [ 'etc/hellanzb.conf.sample' ] ), ],
         )
     py2app_options = dict(
         app = [ 'hellanzb.py' ],