It works!
Woot woot.
This commit is contained in:
17
README.md
17
README.md
@@ -1,5 +1,9 @@
|
||||
# deluge-extractor
|
||||
Plugin for the [deluge](http://deluge-torrent.org/) torrent client that extracts compressed files upon torrent completion.
|
||||
Plugin for the [deluge](http://deluge-torrent.org/) *V2* torrent client that extracts compressed files upon torrent completion.
|
||||
|
||||
This is a modified version of the "Extractor" plugin, with the added option to extract in place.
|
||||
|
||||
This is updated to work on Deluge V2. I'm not sure if it'll work with V1 versions...you tell me. I think it should.0
|
||||
|
||||
* Target folder for extracting the torrent can be specified
|
||||
* A sub folder (name of torrent) can be created within the target folder
|
||||
@@ -7,8 +11,8 @@ Plugin for the [deluge](http://deluge-torrent.org/) torrent client that extracts
|
||||
|
||||
## Has been tested on:
|
||||
|
||||
* Deluge 1.3.x on macOS and Debian Linux / CentOS 7
|
||||
* Deluge 1.3.5 on Windows 7
|
||||
* Deluge 2.0.3
|
||||
|
||||
|
||||
## Supported File formats:
|
||||
|
||||
@@ -70,3 +74,10 @@ For example in the setup below you will have to install the py2.6 egg on the des
|
||||
* Linux server with Python 2.7 running deluged
|
||||
|
||||
#### Note: The Windows installer comes bundled with python: either python 2.6 or 2.7 depending on the intstaller you used.
|
||||
|
||||
|
||||
### Support my work?
|
||||
|
||||
If you dig this plugin and want to say thanks, the best way to do it is by sending a paypal donation to donate.to.digitalhigh@gmail.com
|
||||
|
||||
All donations are appreciated...but none are required :D
|
||||
|
||||
12
setup.py
12
setup.py
@@ -16,7 +16,7 @@ from setuptools import find_packages, setup
|
||||
__plugin_name__ = 'SimpleExtractor'
|
||||
__author__ = 'Digitalhigh'
|
||||
__author_email__ = 'donate.to.digitalhigh@gmail.com'
|
||||
__version__ = '0.7'
|
||||
__version__ = '0.8'
|
||||
__url__ = 'github.com/d8ahazard/deluge-extractor'
|
||||
__license__ = 'GPLv3'
|
||||
__description__ = 'Extract files upon torrent completion'
|
||||
@@ -30,7 +30,7 @@ Windows support: .rar, .zip, .tar, .7z, .xz, .lzma
|
||||
|
||||
Note: Will not extract with 'Move Completed' enabled
|
||||
"""
|
||||
__pkg_data__ = {'deluge_' + __plugin_name__.lower(): ['data/*']}
|
||||
__pkg_data__ = {__plugin_name__.lower(): ['template/*', 'data/*']}
|
||||
|
||||
setup(
|
||||
name=__plugin_name__,
|
||||
@@ -41,15 +41,15 @@ setup(
|
||||
url=__url__,
|
||||
license=__license__,
|
||||
long_description=__long_description__ if __long_description__ else __description__,
|
||||
packages=find_packages(),
|
||||
packages=[__plugin_name__.lower()],
|
||||
package_data=__pkg_data__,
|
||||
entry_points="""
|
||||
[deluge.plugin.core]
|
||||
%s = deluge_%s:CorePlugin
|
||||
%s = %s:CorePlugin
|
||||
[deluge.plugin.gtk3ui]
|
||||
%s = deluge_%s:GtkUIPlugin
|
||||
%s = %s:GtkUIPlugin
|
||||
[deluge.plugin.web]
|
||||
%s = deluge_%s:WebUIPlugin
|
||||
%s = %s:WebUIPlugin
|
||||
"""
|
||||
% ((__plugin_name__, __plugin_name__.lower()) * 3),
|
||||
)
|
||||
|
||||
@@ -1,60 +1,40 @@
|
||||
#
|
||||
# __init__.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2015 Chris Yereaztian <chris.yereaztian@gmail.com>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
from deluge.plugins.init import PluginInitBase
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from deluge.plugins.init import PluginInitBase
|
||||
|
||||
|
||||
class CorePlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from core import Core as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
from .core import Core as _pluginCls
|
||||
|
||||
self._plugin_cls = _pluginCls
|
||||
super(CorePlugin, self).__init__(plugin_name)
|
||||
|
||||
|
||||
class GtkUIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from gtkui import GtkUI as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
from .gtkui import GtkUI as _pluginCls
|
||||
|
||||
self._plugin_cls = _pluginCls
|
||||
super(GtkUIPlugin, self).__init__(plugin_name)
|
||||
|
||||
|
||||
class WebUIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from webui import WebUI as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
from .webui import WebUI as _pluginCls
|
||||
|
||||
self._plugin_cls = _pluginCls
|
||||
super(WebUIPlugin, self).__init__(plugin_name)
|
||||
|
||||
@@ -20,4 +20,4 @@ from pkg_resources import resource_filename
|
||||
|
||||
|
||||
def get_resource(filename):
|
||||
return resource_filename(__package__, os.path.join('data', filename))
|
||||
return resource_filename("simpleextractor", os.path.join('data', filename))
|
||||
|
||||
@@ -28,7 +28,7 @@ from deluge.plugins.pluginbase import CorePluginBase
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_PREFS = {'extract_path': '', 'use_name_folder': True, 'in_place_extraction': True}
|
||||
DEFAULT_PREFS = {'extract_path': '', 'use_name_folder': False, 'in_place_extraction': True}
|
||||
|
||||
if windows_check():
|
||||
win_7z_exes = [
|
||||
@@ -128,6 +128,7 @@ class Core(CorePluginBase):
|
||||
|
||||
files = tid.get_files()
|
||||
for f in files:
|
||||
log.debug("Handling file %s", f['path'])
|
||||
file_root, file_ext = os.path.splitext(f['path'])
|
||||
file_ext_sec = os.path.splitext(file_root)[1]
|
||||
if file_ext_sec and file_ext_sec + file_ext in EXTRACT_COMMANDS:
|
||||
@@ -152,8 +153,9 @@ class Core(CorePluginBase):
|
||||
# Override destination if in_place_extraction is set
|
||||
if self.config["in_place_extraction"]:
|
||||
name = tid_status["name"]
|
||||
save_path = tid_status["save_path"]
|
||||
save_path = tid_status["download_location"]
|
||||
dest = os.path.join(save_path, name)
|
||||
log.debug("Save path is %s, dest is %s, fpath is %s", save_path, dest, fpath)
|
||||
|
||||
# Create the destination folder if it doesn't exist
|
||||
if not os.path.exists(dest):
|
||||
|
||||
@@ -39,7 +39,7 @@ class GtkUI(Gtk3PluginBase):
|
||||
self.builder.add_from_file(get_resource('extractor_prefs.ui'))
|
||||
|
||||
component.get('Preferences').add_page(
|
||||
_('Extractor'), self.builder.get_object('extractor_prefs_box')
|
||||
_('SimpleExtractor'), self.builder.get_object('extractor_prefs_box')
|
||||
)
|
||||
component.get('PluginManager').register_hook(
|
||||
'on_apply_prefs', self.on_apply_prefs
|
||||
@@ -50,7 +50,7 @@ class GtkUI(Gtk3PluginBase):
|
||||
self.on_show_prefs()
|
||||
|
||||
def disable(self):
|
||||
component.get('Preferences').remove_page(_('Extractor'))
|
||||
component.get('Preferences').remove_page(_('SimpleExtractor'))
|
||||
component.get('PluginManager').deregister_hook(
|
||||
'on_apply_prefs', self.on_apply_prefs
|
||||
)
|
||||
@@ -60,7 +60,7 @@ class GtkUI(Gtk3PluginBase):
|
||||
del self.builder
|
||||
|
||||
def on_apply_prefs(self):
|
||||
log.debug('applying prefs for Extractor')
|
||||
log.debug('applying prefs for Simple Extractor')
|
||||
if client.is_localhost():
|
||||
path = self.builder.get_object('folderchooser_path').get_filename()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user