#2290: AutoExtractor Plugin fails to extract files with periods ( . )
-----------------------+----------------------------------------------------
 Reporter:  three18ti  |       Owner:  Cas     
     Type:  bug        |      Status:  assigned
 Priority:  minor      |   Milestone:  1.3.x   
Component:  plugin     |     Version:  1.3.6   
 Keywords:             |  
-----------------------+----------------------------------------------------

Comment(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
 }}}

-- 
Ticket URL: <http://dev.deluge-torrent.org/ticket/2290#comment:3>
Deluge <http://deluge-torrent.org/>
Deluge project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/deluge-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to