Fix the extracting command call
Touch up the gtkui config a bit
This commit is contained in:
parent
b883ffc474
commit
6c023c111f
|
@ -63,6 +63,9 @@ EXTRACT_COMMANDS = {
|
|||
class Core(CorePluginBase):
|
||||
def enable(self):
|
||||
self.config = deluge.configmanager.ConfigManager("extractor.conf", DEFAULT_PREFS)
|
||||
if not self.config["extract_path"]:
|
||||
self.config["extract_path"] = deluge.configmanager.ConfigManager("core.conf")["download_location"]
|
||||
|
||||
component.get("EventManager").register_event_handler("TorrentFinishedEvent", self._on_torrent_finished)
|
||||
|
||||
def disable(self):
|
||||
|
@ -81,7 +84,7 @@ class Core(CorePluginBase):
|
|||
files = component.get("TorrentManager")[torrent_id].get_files()
|
||||
for f in files:
|
||||
ext = os.path.splitext(f["path"])
|
||||
if ext in (".gz", ".bz2", ".lzma"):
|
||||
if ext[1] in (".gz", ".bz2", ".lzma"):
|
||||
# We need to check if this is a tar
|
||||
if os.path.splitext(ext[0]) == ".tar":
|
||||
cmd = EXTRACT_COMMANDS[".tar" + ext[1]]
|
||||
|
@ -108,7 +111,7 @@ class Core(CorePluginBase):
|
|||
log.debug("Extract failed for %s", torrent_id)
|
||||
|
||||
# Run the command and add some callbacks
|
||||
d = getProcessValue(cmd[0], cmd[1:] + [fp], {}, dest)
|
||||
d = getProcessValue(cmd[0], cmd[1].split() + [str(fp)], {}, str(dest))
|
||||
d.addCallback(on_extract_success, torrent_id)
|
||||
d.addErrback(on_extract_failed, torrent_id)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Fri May 1 18:23:42 2009 -->
|
||||
<!--Generated with glade3 3.4.5 on Wed May 6 12:45:11 2009 -->
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<child>
|
||||
|
@ -13,49 +13,51 @@
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Extract to:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Extract to:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="folderchooser_path">
|
||||
<property name="visible">True</property>
|
||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||
<property name="title" translatable="yes">Select A Folder</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry_path">
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry_path">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
@ -70,10 +72,6 @@
|
|||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
|
|
@ -54,7 +54,7 @@ class GtkUI(GtkPluginBase):
|
|||
component.get("Preferences").add_page("Extractor", self.glade.get_widget("extractor_prefs_box"))
|
||||
component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
|
||||
component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
|
||||
|
||||
self.on_show_prefs()
|
||||
|
||||
def disable(self):
|
||||
component.get("Preferences").remove_page("Extractor")
|
||||
|
@ -82,7 +82,6 @@ class GtkUI(GtkPluginBase):
|
|||
else:
|
||||
self.glade.get_widget("folderchooser_path").hide()
|
||||
self.glade.get_widget("entry_path").show()
|
||||
self.glade.get_widget("folderchooser_path").show()
|
||||
|
||||
def on_get_config(config):
|
||||
if client.is_localhost():
|
||||
|
|
Loading…
Reference in New Issue