rename to deluge_core in the cpp file
This commit is contained in:
parent
eaea97b042
commit
437649aad0
|
@ -111,7 +111,7 @@ torrents_t *M_torrents = NULL;
|
||||||
// Exception types & macro
|
// Exception types & macro
|
||||||
//------------------------
|
//------------------------
|
||||||
|
|
||||||
static PyObject *FloodError = NULL;
|
static PyObject *DelugeError = NULL;
|
||||||
static PyObject *InvalidEncodingError = NULL;
|
static PyObject *InvalidEncodingError = NULL;
|
||||||
static PyObject *FilesystemError = NULL;
|
static PyObject *FilesystemError = NULL;
|
||||||
static PyObject *DuplicateTorrentError = NULL;
|
static PyObject *DuplicateTorrentError = NULL;
|
||||||
|
@ -148,7 +148,7 @@ long get_torrent_index(torrent_handle &handle)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
RAISE_INT(FloodError, "Handle not found.");
|
RAISE_INT(DelugeError, "Handle not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
long get_index_from_unique_ID(long unique_ID)
|
long get_index_from_unique_ID(long unique_ID)
|
||||||
|
@ -159,7 +159,7 @@ long get_index_from_unique_ID(long unique_ID)
|
||||||
if ((*M_torrents)[i].unique_ID == unique_ID)
|
if ((*M_torrents)[i].unique_ID == unique_ID)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
RAISE_INT(FloodError, "No such unique_ID.");
|
RAISE_INT(DelugeError, "No such unique_ID.");
|
||||||
}
|
}
|
||||||
|
|
||||||
long internal_add_torrent(std::string const& torrent_name,
|
long internal_add_torrent(std::string const& torrent_name,
|
||||||
|
@ -269,7 +269,7 @@ long count_DHT_peers(entry &state)
|
||||||
|
|
||||||
static PyObject *torrent_pre_init(PyObject *self, PyObject *args)
|
static PyObject *torrent_pre_init(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, "OOOOO", &FloodError,
|
if (!PyArg_ParseTuple(args, "OOOOO", &DelugeError,
|
||||||
&InvalidEncodingError,
|
&InvalidEncodingError,
|
||||||
&FilesystemError,
|
&FilesystemError,
|
||||||
&DuplicateTorrentError,
|
&DuplicateTorrentError,
|
||||||
|
@ -281,7 +281,7 @@ static PyObject *torrent_pre_init(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
static PyObject *torrent_init(PyObject *self, PyObject *args)
|
static PyObject *torrent_init(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
printf("flood_core; using libtorrent %s. Compiled with NDEBUG value: %d\r\n",
|
printf("deluge_core; using libtorrent %s. Compiled with NDEBUG value: %d\r\n",
|
||||||
LIBTORRENT_VERSION,
|
LIBTORRENT_VERSION,
|
||||||
NDEBUG);
|
NDEBUG);
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ static PyObject *torrent_save_fastresume(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
Py_INCREF(Py_None); return Py_None;
|
Py_INCREF(Py_None); return Py_None;
|
||||||
} else
|
} else
|
||||||
RAISE_PTR(FloodError, "Invalid handle or no metadata for fastresume.");
|
RAISE_PTR(DelugeError, "Invalid handle or no metadata for fastresume.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *torrent_set_max_half_open(PyObject *self, PyObject *args)
|
static PyObject *torrent_set_max_half_open(PyObject *self, PyObject *args)
|
||||||
|
@ -1118,7 +1118,7 @@ static PyObject *torrent_create_torrent(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
// std::cerr << e.what() << "\n";
|
// std::cerr << e.what() << "\n";
|
||||||
// return Py_BuildValue("l", 0);
|
// return Py_BuildValue("l", 0);
|
||||||
RAISE_PTR(FloodError, e.what());
|
RAISE_PTR(DelugeError, e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,7 +1168,7 @@ static PyObject *torrent_apply_IP_filter(PyObject *self, PyObject *args)
|
||||||
// Python Module data
|
// Python Module data
|
||||||
//====================
|
//====================
|
||||||
|
|
||||||
static PyMethodDef flood_core_methods[] = {
|
static PyMethodDef deluge_core_methods[] = {
|
||||||
{"pre_init", torrent_pre_init, METH_VARARGS, "."},
|
{"pre_init", torrent_pre_init, METH_VARARGS, "."},
|
||||||
{"init", torrent_init, METH_VARARGS, "."},
|
{"init", torrent_init, METH_VARARGS, "."},
|
||||||
{"quit", torrent_quit, METH_VARARGS, "."},
|
{"quit", torrent_quit, METH_VARARGS, "."},
|
||||||
|
@ -1205,7 +1205,7 @@ static PyMethodDef flood_core_methods[] = {
|
||||||
|
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
initflood_core(void)
|
initdeluge_core(void)
|
||||||
{
|
{
|
||||||
Py_InitModule("flood_core", flood_core_methods);
|
Py_InitModule("deluge_core", deluge_core_methods);
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# Documentation:
|
# Documentation:
|
||||||
# Torrents have 3 structures:
|
# Torrents have 3 structures:
|
||||||
# 1. torrent_info - persistent data, like name, upload speed cap, etc.
|
# 1. torrent_info - persistent data, like name, upload speed cap, etc.
|
||||||
# 2. core_torrent_state - transient state data from the core. This may take
|
# 2. core_torrent_state - transient state data from the core. This may take
|
||||||
# time to calculate, so we do if efficiently
|
# time to calculate, so we do if efficiently
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
# 51 Franklin Street, Fifth Floor
|
# 51 Franklin Street, Fifth Floor
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
import deluge
|
||||||
|
|
||||||
import dcommon, dgtk
|
import dcommon, dgtk
|
||||||
|
|
||||||
import sys, os, gettext
|
import sys, os, gettext
|
||||||
|
|
6
test.py
6
test.py
|
@ -13,14 +13,14 @@ import deluge
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import os
|
import os
|
||||||
|
|
||||||
manager = deluge.manager("FL", "0500", "deluge - testing only",
|
manager = deluge.manager("DL", "0500", "deluge - testing only",
|
||||||
os.path.expanduser("~") + "/Temp")# blank_slate=True)
|
os.path.expanduser("~") + "/Temp")# blank_slate=True)
|
||||||
|
|
||||||
#manager.set_pref('max_upload_rate', 6*1024)
|
#manager.set_pref('max_upload_rate', 6*1024)
|
||||||
|
|
||||||
#my_torrent = manager.add_torrent("xubuntu-6.10-desktop-i386.iso.torrent", ".", True)
|
my_torrent = manager.add_torrent("ubuntu.iso.torrent", ".", True)
|
||||||
|
|
||||||
#print "Unique ID:", my_torrent
|
print "Unique ID:", my_torrent
|
||||||
|
|
||||||
print "PREFS:", manager.prefs
|
print "PREFS:", manager.prefs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue