diff --git a/README.md b/README.md
index 36335fe..b150a02 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# FilebotTool: FileBot Integration for Deluge
*requires [Filebot](http://www.filebot.net/)*
-**Version 1.2.3**
+**Version 1.2.4**
##### [Download Latest Release](https://github.com/Laharah/deluge-FilebotTool/releases/latest)
diff --git a/filebottool/core.py b/filebottool/core.py
index 6c8b5ae..bb2c0dd 100755
--- a/filebottool/core.py
+++ b/filebottool/core.py
@@ -913,7 +913,7 @@ def activate_filebot_license(self, data):
license_file.write(data)
license_file.close()
try:
- result = yield threads.deferToThread(pyfilebot.license(license_file.name))
+ result = yield threads.deferToThread(pyfilebot.license, license_file.name)
except pyfilebot.FilebotLicenseError as error:
log.error("Error during licensing", exc_info=True)
result = "{0}: {1}".format(error.__class__.__name__, error.message)
@@ -922,4 +922,4 @@ def activate_filebot_license(self, data):
finally:
license_file.unlink(license_file.name)
del license_file
- defer.retunValue(result)
+ defer.returnValue(result)
diff --git a/filebottool/data/config.glade b/filebottool/data/config.glade
index de45c87..cbb0ad7 100755
--- a/filebottool/data/config.glade
+++ b/filebottool/data/config.glade
@@ -305,8 +305,47 @@
0
+
+
+ True
+ True
+ True
+ Select a license file that FileBot Should Use
+
+
+
+ True
+
+
+ True
+ gtk-missing-image
+
+
+ 0
+
+
+
+
+ True
+ Register FileBot
+
+
+ 1
+
+
+
+
+
+
+ False
+ False
+ 1
+
+
+ False
+ False
4
diff --git a/filebottool/gtkui/config_ui.py b/filebottool/gtkui/config_ui.py
index 1330d36..6d8b5dd 100644
--- a/filebottool/gtkui/config_ui.py
+++ b/filebottool/gtkui/config_ui.py
@@ -2,6 +2,7 @@
import gtk
+import os
import time
import webbrowser
@@ -34,6 +35,10 @@ def __init__(self, settings=None):
self.config_page = self.glade.get_widget("prefs_box")
self.pref_dialog = component.get("Preferences").pref_dialog
+ fb_icon = self.glade.get_widget("fb_icon")
+ image = get_resource("fb_icon16.png")
+ fb_icon.set_from_file(image)
+
model = gtk.ListStore(str)
view = self.glade.get_widget('saved_handlers_listview')
renderer = gtk.CellRendererText()
@@ -76,6 +81,7 @@ def text_edited(widget, path, text):
"on_add_rule": self.on_add_rule,
"on_auto_sort_help_clicked": self.on_auto_sort_help_clicked,
"on_debug_button_clicked": self.on_debug_button_clicked,
+ "on_license_button_clicked": self.on_license_button_clicked,
})
self.gather_time = None
if settings:
@@ -183,6 +189,64 @@ def on_debug_button_clicked(self, button):
dialog.display_text("Filebot Debug Info", info)
button.set_sensitive(True)
+ @defer.inlineCallbacks
+ def on_license_button_clicked(self, button):
+ log.debug("License button clicked.")
+ chooser = gtk.FileChooserDialog(_("Choose your FileBot license file"),
+ None,
+ gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
+ gtk.RESPONSE_OK))
+
+ chooser.set_transient_for(self.pref_dialog)
+ chooser.set_property("skip-taskbar-hint", True)
+ chooser.set_local_only(False)
+
+ file_filter = gtk.FileFilter()
+ file_filter.set_name(_("FileBot license files"))
+ file_filter.add_pattern("*." + "psm")
+ chooser.add_filter(file_filter)
+ file_filter = gtk.FileFilter()
+ file_filter.set_name(_("All files"))
+ file_filter.add_pattern("*")
+ chooser.add_filter(file_filter)
+
+ # Run the dialog
+ response = chooser.run()
+
+ if response == gtk.RESPONSE_OK:
+ license = chooser.get_filenames()[0]
+ else:
+ chooser.destroy()
+ return
+ chooser.destroy()
+
+ # License file should definetly be under 10K
+ size = os.stat(license).st_size
+ if size > 10*1000:
+ e = user_messenger.InfoDialog("Error", "License file is too big.")
+ e.resize(220, 125)
+ e.run_async()
+ defer.returnValue()
+
+ with open(license, 'rb') as l:
+ license_data = l.read()
+ log.debug("Sending license data to server.")
+ result = yield client.filebottool.activate_filebot_license(license_data)
+ log.debug("Recieved reply from server: %s", result)
+ if result.startswith("FilebotLicenseError: "):
+ title = "Error with License File"
+ msg = result[21:]
+ else:
+ title = "Success!"
+ msg = result
+
+ dialog = user_messenger.InfoDialog(title, msg)
+ dialog.resize(220, 125)
+ dialog.run_async()
+
+
+
#########
# Section: Utilities
diff --git a/setup.py b/setup.py
index fa99761..9d8a56d 100755
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,7 @@
__plugin_name__ = "FileBotTool"
__author__ = "laharah"
__author_email__ = "laharah+fbt@gmail.com"
-__version__ = "1.2.3"
+__version__ = "1.2.4"
__url__ = "https://github.com/Laharah/deluge-FileBotTool"
__license__ = "GPLv3"
__description__ = "Integrates FileBot functionality to Deluge"