From 63621be3ee4857f96ad76063e67ed5672079c9d7 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Wed, 5 Sep 2007 17:35:44 +0000 Subject: [PATCH] add private flag to torrentcreator --- plugins/TorrentCreator/__init__.py | 4 +- plugins/TorrentCreator/torrentcreator.glade | 113 +++++++++++--------- src/core.py | 4 +- src/deluge_core.cpp | 7 +- 4 files changed, 73 insertions(+), 55 deletions(-) diff --git a/plugins/TorrentCreator/__init__.py b/plugins/TorrentCreator/__init__.py index 710ba1d9d..30703b952 100644 --- a/plugins/TorrentCreator/__init__.py +++ b/plugins/TorrentCreator/__init__.py @@ -148,13 +148,13 @@ class TorrentCreator: author = _("Deluge") add_torrent = self.glade.get_widget("add_torrent_checkbox").get_active() - + set_private = self.glade.get_widget("chk_set_priv").get_active() # Destroy the dialog.. we don't need it anymore self.destroy() # Create the torrent and add it to the queue if necessary if self.core.create_torrent(torrent, source, trackers, comments, - piece_size, author) == 1: + piece_size, author, set_private) == 1: # Torrent was created successfully if add_torrent: # We need to add this torrent to the queue diff --git a/plugins/TorrentCreator/torrentcreator.glade b/plugins/TorrentCreator/torrentcreator.glade index 5bec63646..37afcbd3d 100644 --- a/plugins/TorrentCreator/torrentcreator.glade +++ b/plugins/TorrentCreator/torrentcreator.glade @@ -1,6 +1,6 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -70,17 +70,28 @@ 2 2 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - This torrent will be made from a directory - Folder: - 0 - True - True + 1 + 2 + 1 + 2 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + + + 1 + 2 + GTK_FILL @@ -102,28 +113,17 @@ - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + This torrent will be made from a directory + Folder: + 0 + True + True - 1 - 2 - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 @@ -171,14 +171,22 @@ 1 3 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Save Torrent File As: + + - 1 - 2 + GTK_FILL @@ -206,22 +214,14 @@ - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Save Torrent File As: - - - GTK_FILL + 1 + 2 @@ -414,21 +414,26 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 + 2 2 10 - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - The smaller the piece sizes, the more efficient the transfers will be, but the actual ".torrent" file will be larger - 0 - Piece Size: + Set Private Flag + 0 + True - + 1 + 2 + + + True @@ -449,6 +454,18 @@ + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The smaller the piece sizes, the more efficient the transfers will be, but the actual ".torrent" file will be larger + 0 + Piece Size: + + + + + diff --git a/src/core.py b/src/core.py index 6c31e86a2..3972c7b17 100644 --- a/src/core.py +++ b/src/core.py @@ -981,8 +981,8 @@ class Manager: return ret def create_torrent(self, filename, source_directory, trackers, comments=None, - piece_size=32, author="Deluge"): - return deluge_core.create_torrent(filename, source_directory, trackers, comments, piece_size, author) + piece_size=32, author="Deluge", private=False): + return deluge_core.create_torrent(filename, source_directory, trackers, comments, piece_size, author, private) # Creates/resets the IP filter list def reset_ip_filter(self): diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 70535c53c..a31306ef2 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -1475,9 +1475,10 @@ static PyObject *torrent_create_torrent(PyObject *self, PyObject *args) //path::default_name_check(no_check); char *destination, *comment, *creator_str, *input, *trackers; + bool *priv; python_long piece_size; - if (!PyArg_ParseTuple(args, "ssssis", - &destination, &input, &trackers, &comment, &piece_size, &creator_str)) + if (!PyArg_ParseTuple(args, "ssssisb", + &destination, &input, &trackers, &comment, &piece_size, &creator_str, &priv)) return NULL; piece_size = piece_size * 1024; @@ -1519,7 +1520,7 @@ static PyObject *torrent_create_torrent(PyObject *self, PyObject *args) t->set_creator(creator_str); t->set_comment(comment); - + t->set_priv(priv); entry e = t->create_torrent(); bencode(std::ostream_iterator(out), e); return Py_BuildValue("l", 1);