Fix for deluge-console adding torrent files in Windows

This commit is contained in:
Calum Lind 2011-02-04 23:16:42 +00:00
parent e688b45448
commit 9bca1a72b1
2 changed files with 2 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class Command(BaseCommand):
continue continue
self.console.write("{!info!}Attempting to add torrent: %s" % arg) self.console.write("{!info!}Attempting to add torrent: %s" % arg)
filename = os.path.split(arg)[-1] filename = os.path.split(arg)[-1]
filedump = base64.encodestring(open(arg).read()) filedump = base64.encodestring(open(arg, "rb").read())
def on_success(result): def on_success(result):
self.console.write("{!success!}Torrent added!") self.console.write("{!success!}Torrent added!")

View File

@ -369,7 +369,7 @@ class CreateTorrentDialog:
if add_to_session: if add_to_session:
client.core.add_torrent_file( client.core.add_torrent_file(
os.path.split(target)[-1], os.path.split(target)[-1],
base64.encodestring(open(target).read()), base64.encodestring(open(target, "rb").read()),
{"download_location": os.path.split(path)[0]}) {"download_location": os.path.split(path)[0]})
def _on_create_torrent_progress(self, value, num_pieces): def _on_create_torrent_progress(self, value, num_pieces):