Opened 12 years ago

Closed 12 years ago

#2290 closed bug (Fixed)

AutoExtractor Plugin fails to extract files with periods ( . )

Reported by: three18ti Owned by: Calum
Priority: minor Milestone: 1.3.7
Component: Plugin Version: 1.3.6
Keywords: Cc: andareed@gmail.com, a.starr.b@gmail.com

Description

Hello,

Deluge Version: Client: 1.3.6 Server: 1.3.6

OS: Ubuntu, 12.04.1

Since upgrading to deluge 1.3.6 the auto extractor fails to extract files with periods.

Relevant log excerpt:

attached as deluge_auto_extractor_debug_log_20130304.log

Solution:

Cas suggested reverting this commit might fix the problem: http://git.deluge-torrent.org/deluge/commit/?h=1.3-stable&id=7fbe163c24de

Attachments (5)

deluge_auto_extractor_debug_log_20130304.log (2.6 KB ) - added by three18ti 12 years ago.
Deluge debug log of failed autoextractor attempt
Extractor-0.2-py2.7.egg (15.2 KB ) - added by Calum 12 years ago.
Reverted commit plugin
deluge-extractor.patch (2.2 KB ) - added by Andareed 12 years ago.
Cleaner extractor fix
Extractor-0.3-py2.7.egg (15.3 KB ) - added by Calum 12 years ago.
Extractor-0.3-py2.6.egg (15.3 KB ) - added by Calum 12 years ago.

Download all attachments as: .zip

Change History (11)

by three18ti, 12 years ago

Deluge debug log of failed autoextractor attempt

comment:1 by Calum, 12 years ago

Milestone: Future1.3.x
Owner: changed from three18ti to Calum
Status: newassigned
Version: other (please specify)1.3.6

by Calum, 12 years ago

Attachment: Extractor-0.2-py2.7.egg added

Reverted commit plugin

by Andareed, 12 years ago

Attachment: deluge-extractor.patch added

Cleaner extractor fix

comment:2 by Andareed, 12 years ago

Cc: andareed@gmail.com added

I attached a cleaner patch.

comment:3 by Calum, 12 years ago

Although your code works, the result relies on the alphabetical order of the extensions which is not ideal.

This is the code that I put together a few days ago and was looking to commit:

diff --git a/deluge/plugins/extractor/extractor/core.py b/deluge/plugins/extractor/extractor/core.py
index 50f3faf..168fa7d 100644
--- a/deluge/plugins/extractor/extractor/core.py
+++ b/deluge/plugins/extractor/extractor/core.py
@@ -132,11 +132,14 @@ 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:
+            file_ext = os.path.splitext(f["path"])[1]
+            file_ext_pair = os.path.splitext(os.path.splitext(f["path"])[0])[1] + file_ext
+            if file_ext_pair in EXTRACT_COMMANDS:
+                cmd = EXTRACT_COMMANDS[file_ext_pair]
+            elif file_ext in EXTRACT_COMMANDS:
                 cmd = EXTRACT_COMMANDS[file_ext]
             else:
-                log.error("EXTRACTOR: Can't extract unknown file type: %s", file_ext)
+                log.error("EXTRACTOR: Can't extract unknown file type: %s", f["path"])
                 continue
 
             # Now that we have the cmd, lets run it to extract the files

comment:4 by andrewsomething, 12 years ago

Cc: a.starr.b@gmail.com added

comment:5 by Calum, 12 years ago

After much testing finally came up with a fix that works properly:

Fixed 1.3-stable: http://git.deluge-torrent.org/deluge/commit/?h=1.3-stable&id=f1074858716

@Andareed: My comment is incorrect, the EXTRACT_COMMANDS dict is not actually sorted so there is no way to know in advance whether for example '.lzma' will be after '.tar.lzma' if that extension is added at a later date and sorting the dict alphabetically would not help either due to the potential of '.xz' and '.tar.xz' co-existing.

by Calum, 12 years ago

Attachment: Extractor-0.3-py2.7.egg added

by Calum, 12 years ago

Attachment: Extractor-0.3-py2.6.egg added

comment:6 by Calum, 12 years ago

Milestone: 1.3.x1.3.7
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.