Opened 11 years ago

Closed 11 years ago

#2290 closed bug (Fixed)

AutoExtractor Plugin fails to extract files with periods ( . )

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

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 11 years ago.
Deluge debug log of failed autoextractor attempt
Extractor-0.2-py2.7.egg (15.2 KB) - added by Cas 11 years ago.
Reverted commit plugin
deluge-extractor.patch (2.2 KB) - added by Andareed 11 years ago.
Cleaner extractor fix
Extractor-0.3-py2.7.egg (15.3 KB) - added by Cas 11 years ago.
Extractor-0.3-py2.6.egg (15.3 KB) - added by Cas 11 years ago.

Download all attachments as: .zip

Change History (11)

Changed 11 years ago by three18ti

Deluge debug log of failed autoextractor attempt

comment:1 Changed 11 years ago by Cas

  • Milestone changed from Future to 1.3.x
  • Owner changed from three18ti to Cas
  • Status changed from new to assigned
  • Version changed from other (please specify) to 1.3.6

Changed 11 years ago by Cas

Reverted commit plugin

Changed 11 years ago by Andareed

Cleaner extractor fix

comment:2 Changed 11 years ago by Andareed

  • Cc andareed@… added

I attached a cleaner patch.

comment:3 Changed 11 years ago by Cas

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 Changed 11 years ago by andrewsomething

  • Cc a.starr.b@… added

comment:5 Changed 11 years ago by Cas

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.

Changed 11 years ago by Cas

Changed 11 years ago by Cas

comment:6 Changed 11 years ago by Cas

  • Milestone changed from 1.3.x to 1.3.7
  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.