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):
|
class Core(CorePluginBase):
|
||||||
def enable(self):
|
def enable(self):
|
||||||
self.config = deluge.configmanager.ConfigManager("extractor.conf", DEFAULT_PREFS)
|
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)
|
component.get("EventManager").register_event_handler("TorrentFinishedEvent", self._on_torrent_finished)
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
|
@ -81,7 +84,7 @@ class Core(CorePluginBase):
|
||||||
files = component.get("TorrentManager")[torrent_id].get_files()
|
files = component.get("TorrentManager")[torrent_id].get_files()
|
||||||
for f in files:
|
for f in files:
|
||||||
ext = os.path.splitext(f["path"])
|
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
|
# We need to check if this is a tar
|
||||||
if os.path.splitext(ext[0]) == ".tar":
|
if os.path.splitext(ext[0]) == ".tar":
|
||||||
cmd = EXTRACT_COMMANDS[".tar" + ext[1]]
|
cmd = EXTRACT_COMMANDS[".tar" + ext[1]]
|
||||||
|
@ -108,7 +111,7 @@ class Core(CorePluginBase):
|
||||||
log.debug("Extract failed for %s", torrent_id)
|
log.debug("Extract failed for %s", torrent_id)
|
||||||
|
|
||||||
# Run the command and add some callbacks
|
# 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.addCallback(on_extract_success, torrent_id)
|
||||||
d.addErrback(on_extract_failed, torrent_id)
|
d.addErrback(on_extract_failed, torrent_id)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
<!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>
|
<glade-interface>
|
||||||
<widget class="GtkWindow" id="window1">
|
<widget class="GtkWindow" id="window1">
|
||||||
<child>
|
<child>
|
||||||
|
@ -12,13 +12,10 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label_xalign">0</property>
|
<property name="label_xalign">0</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="left_padding">12</property>
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<widget class="GtkVBox" id="vbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="border_width">5</property>
|
||||||
<property name="spacing">5</property>
|
<property name="spacing">5</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox1">
|
<widget class="GtkHBox" id="hbox1">
|
||||||
|
@ -35,27 +32,32 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkFileChooserButton" id="folderchooser_path">
|
<widget class="GtkHBox" id="hbox2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFileChooserButton" id="folderchooser_path">
|
||||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||||
<property name="title" translatable="yes">Select A Folder</property>
|
<property name="title" translatable="yes">Select A Folder</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="entry_path">
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<widget class="GtkEntry" id="entry_path">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
<packing>
|
||||||
</widget>
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
@ -70,10 +72,6 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
|
@ -54,7 +54,7 @@ class GtkUI(GtkPluginBase):
|
||||||
component.get("Preferences").add_page("Extractor", self.glade.get_widget("extractor_prefs_box"))
|
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_apply_prefs", self.on_apply_prefs)
|
||||||
component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
|
component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
|
||||||
|
self.on_show_prefs()
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
component.get("Preferences").remove_page("Extractor")
|
component.get("Preferences").remove_page("Extractor")
|
||||||
|
@ -82,7 +82,6 @@ class GtkUI(GtkPluginBase):
|
||||||
else:
|
else:
|
||||||
self.glade.get_widget("folderchooser_path").hide()
|
self.glade.get_widget("folderchooser_path").hide()
|
||||||
self.glade.get_widget("entry_path").show()
|
self.glade.get_widget("entry_path").show()
|
||||||
self.glade.get_widget("folderchooser_path").show()
|
|
||||||
|
|
||||||
def on_get_config(config):
|
def on_get_config(config):
|
||||||
if client.is_localhost():
|
if client.is_localhost():
|
||||||
|
|
Loading…
Reference in New Issue