commit 2a6d844925f841aaf6cd20cd819281c82eb43839
Author: David Bartley <andareed@gmail.com>
Date:   Sat Mar 23 15:03:07 2013 -0700

    Fix the extractor plugin so that it works with rar and similar files that end with .foo.rar.

diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py
index f8ccb0b..c03ec8d 100644
--- a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py
+++ b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py
@@ -133,12 +133,11 @@ def _on_torrent_finished(self, torrent_id):
 
         files = tid.get_files()
         for f in files:
-            cmd = ''
-            file_ext = os.path.splitext(os.path.splitext(f["path"])[0])[1] + os.path.splitext(f["path"])[1]
-            if file_ext in EXTRACT_COMMANDS:
-                cmd = EXTRACT_COMMANDS[file_ext]
+            matches = [cmd for (ext,cmd) in EXTRACT_COMMANDS.iteritems() if f["path"].endswith(ext)]
+            if matches:
+                cmd = matches[0]
             else:
-                log.error("Can't extract unknown file type: %s", file_ext)
+                log.error("Can't extract file with unknown file type: %s", f["path"])
                 continue
 
             # Now that we have the cmd, lets run it to extract the files
@@ -167,11 +166,10 @@ def on_extract_failed(result, torrent_id, fpath):
                 log.error("Extract failed: %s (%s)", fpath, torrent_id)
 
             # Run the command and add some callbacks
-            if cmd:
-                log.debug("Extracting %s with %s %s to %s", fpath, cmd[0], cmd[1], dest)
-                d = getProcessValue(cmd[0], cmd[1].split() + [str(fpath)], {}, str(dest))
-                d.addCallback(on_extract_success, torrent_id, fpath)
-                d.addErrback(on_extract_failed, torrent_id, fpath)
+            log.debug("Extracting %s with %s %s to %s", fpath, cmd[0], cmd[1], dest)
+            d = getProcessValue(cmd[0], cmd[1].split() + [str(fpath)], {}, str(dest))
+            d.addCallback(on_extract_success, torrent_id, fpath)
+            d.addErrback(on_extract_failed, torrent_id, fpath)
 
     @export
     def set_config(self, config):
