Используем временные карты кусков торрента
parent
6e38768f3d
commit
a3b36b9794
|
@ -5,7 +5,7 @@
|
|||
GOCMD=go
|
||||
GOBUILD=$(GOCMD) build -mod=mod
|
||||
GOIMPORTS=goimports
|
||||
PYTHON=/usr/bin/python
|
||||
PYTHON=env python3
|
||||
LIBEXT=.so
|
||||
|
||||
# get the CC and flags used to build python:
|
||||
|
|
|
@ -5,18 +5,15 @@
|
|||
GOCMD=go
|
||||
GOBUILD=$(GOCMD) build -mod=mod
|
||||
GOIMPORTS=goimports
|
||||
PYTHON=/usr/bin/python
|
||||
PYTHON=env python3
|
||||
LIBEXT=.so
|
||||
|
||||
# get the CC and flags used to build python:
|
||||
GCC = $(shell $(GOCMD) env CC)
|
||||
CFLAGS = -I/usr/include/python3.9
|
||||
LDFLAGS = -L/usr/lib64 -lpython3.9 -lpthread -ldl -lutil -lm -lm
|
||||
CFLAGS = $(shell python3-config --includes)
|
||||
LDFLAGS = -L/usr/lib64 $(BOOST_ROOT)/stage/lib/libboost_python*.a -lpthread -ldl -lutil -lm -lm
|
||||
|
||||
all: gen build
|
||||
|
||||
gen:
|
||||
gopy gen -no-make -gorrent
|
||||
all: build
|
||||
|
||||
build:
|
||||
# build target builds the generated files -- this is what gopy build does..
|
||||
|
@ -25,14 +22,12 @@ build:
|
|||
# goimports is needed to ensure that the imports list is valid
|
||||
$(GOIMPORTS) -w gorrent.go
|
||||
# generate gorrent_go$(LIBEXT) from gorrent.go -- the cgo wrappers to go functions
|
||||
$(GOBUILD) -buildmode=c-shared -o gorrent_go$(LIBEXT) gorrent.go
|
||||
$(GOBUILD) -buildmode=c-archive -o gorrent_go.a gorrent.go
|
||||
# use pybindgen to build the gorrent.c file which are the CPython wrappers to cgo wrappers..
|
||||
# note: pip install pybindgen to get pybindgen if this fails
|
||||
$(PYTHON) build.py
|
||||
# build the _gorrent$(LIBEXT) library that contains the cgo and CPython wrappers
|
||||
# generated gorrent.py python wrapper imports this c-code package
|
||||
|
||||
$(GCC) gorrent.c gorrent_go$(LIBEXT) -o _gorrent$(LIBEXT) $(CFLAGS) $(LDFLAGS) -fPIC --shared -w
|
||||
|
||||
|
||||
$(GCC) gorrent.c gorrent_go.a -o _gorrent$(LIBEXT) $(CFLAGS) $(LDFLAGS) -fPIC --shared -w
|
||||
|
||||
|
|
|
@ -147,14 +147,6 @@ mod.add_function('Slice_Ptr_gorrent_FileInfo_elem', retval('int64_t'), [param('i
|
|||
mod.add_function('Slice_Ptr_gorrent_FileInfo_subslice', retval('int64_t'), [param('int64_t', 'handle'), param('int', 'st'), param('int', 'ed')])
|
||||
mod.add_function('Slice_Ptr_gorrent_FileInfo_set', None, [param('int64_t', 'handle'), param('int', 'idx'), param('int64_t', 'value')])
|
||||
mod.add_function('Slice_Ptr_gorrent_FileInfo_append', None, [param('int64_t', 'handle'), param('int64_t', 'value')])
|
||||
mod.add_function('gorrent_Engine_CTor', retval('int64_t'), [])
|
||||
add_checked_function(mod, 'gorrent_Engine_IsAlive', retval('bool'), [param('int64_t', '_handle')])
|
||||
add_checked_function(mod, 'gorrent_Engine_StartTorrent', retval('char*'), [param('int64_t', '_handle'), param('int64_t', 'idx')])
|
||||
add_checked_function(mod, 'gorrent_Engine_Status', retval('int64_t'), [param('int64_t', '_handle')])
|
||||
add_checked_function(mod, 'gorrent_Engine_FileStatus', retval('int64_t'), [param('int64_t', '_handle'), param('int64_t', 'i')])
|
||||
add_checked_function(mod, 'gorrent_Engine_Stop', None, [param('int64_t', '_handle'), param('bool', 'goRun')])
|
||||
add_checked_string_function(mod, 'gorrent_Engine_GetMsg', retval('char*'), [param('int64_t', '_handle')])
|
||||
add_checked_function(mod, 'gorrent_Engine_Clean', None, [param('int64_t', '_handle'), param('bool', 'goRun')])
|
||||
mod.add_function('gorrent_FileInfo_CTor', retval('int64_t'), [])
|
||||
mod.add_function('gorrent_FileInfo_Length_Get', retval('int64_t'), [param('int64_t', 'handle')])
|
||||
mod.add_function('gorrent_FileInfo_Length_Set', None, [param('int64_t', 'handle'), param('int64_t', 'val')])
|
||||
|
@ -207,9 +199,17 @@ mod.add_function('gorrent_TorrentStatus_UploadRate_Get', retval('int64_t'), [par
|
|||
mod.add_function('gorrent_TorrentStatus_UploadRate_Set', None, [param('int64_t', 'handle'), param('int64_t', 'val')])
|
||||
mod.add_function('gorrent_TorrentStatus_Seeds_Get', retval('int64_t'), [param('int64_t', 'handle')])
|
||||
mod.add_function('gorrent_TorrentStatus_Seeds_Set', None, [param('int64_t', 'handle'), param('int64_t', 'val')])
|
||||
add_checked_function(mod, 'gorrent_NewEngine', retval('int64_t'), [param('int64_t', 'settings')])
|
||||
mod.add_function('gorrent_Engine_CTor', retval('int64_t'), [])
|
||||
add_checked_function(mod, 'gorrent_Engine_IsAlive', retval('bool'), [param('int64_t', '_handle')])
|
||||
add_checked_function(mod, 'gorrent_Engine_StartTorrent', retval('char*'), [param('int64_t', '_handle'), param('int64_t', 'idx')])
|
||||
add_checked_function(mod, 'gorrent_Engine_Status', retval('int64_t'), [param('int64_t', '_handle')])
|
||||
add_checked_function(mod, 'gorrent_Engine_FileStatus', retval('int64_t'), [param('int64_t', '_handle'), param('int64_t', 'i')])
|
||||
add_checked_function(mod, 'gorrent_Engine_Stop', None, [param('int64_t', '_handle'), param('bool', 'goRun')])
|
||||
add_checked_string_function(mod, 'gorrent_Engine_GetMsg', retval('char*'), [param('int64_t', '_handle')])
|
||||
add_checked_function(mod, 'gorrent_Engine_Clean', None, [param('int64_t', '_handle'), param('bool', 'goRun')])
|
||||
add_checked_function(mod, 'gorrent_GetMetaFromFile', retval('int64_t'), [param('char*', 'path')])
|
||||
add_checked_function(mod, 'gorrent_NewSettings', retval('int64_t'), [])
|
||||
add_checked_function(mod, 'gorrent_NewEngine', retval('int64_t'), [param('int64_t', 'settings')])
|
||||
add_checked_string_function(mod, 'gorrent_Version', retval('char*'), [])
|
||||
|
||||
mod.generate(open('gorrent.c', 'w'))
|
||||
|
|
|
@ -1246,102 +1246,6 @@ func handleFromPtr_gorrent_TorrentStatus(p interface{}) CGoHandle {
|
|||
|
||||
// ---- Structs ---
|
||||
|
||||
// --- wrapping struct: gorrent.Engine ---
|
||||
//export gorrent_Engine_CTor
|
||||
func gorrent_Engine_CTor() CGoHandle {
|
||||
return CGoHandle(handleFromPtr_gorrent_Engine(&gorrent.Engine{}))
|
||||
}
|
||||
|
||||
//export gorrent_Engine_IsAlive
|
||||
func gorrent_Engine_IsAlive(_handle CGoHandle) C.char {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return boolGoToPy(false)
|
||||
}
|
||||
return boolGoToPy(gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).IsAlive())
|
||||
|
||||
}
|
||||
|
||||
//export gorrent_Engine_StartTorrent
|
||||
func gorrent_Engine_StartTorrent(_handle CGoHandle, idx C.longlong) *C.char {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return C.CString("")
|
||||
}
|
||||
__err = gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).StartTorrent(int(idx))
|
||||
|
||||
if __err != nil {
|
||||
estr := C.CString(__err.Error())
|
||||
C.PyErr_SetString(C.PyExc_RuntimeError, estr)
|
||||
return estr
|
||||
}
|
||||
return C.CString("")
|
||||
}
|
||||
|
||||
//export gorrent_Engine_Status
|
||||
func gorrent_Engine_Status(_handle CGoHandle) CGoHandle {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return handleFromPtr_gorrent_TorrentStatus(nil)
|
||||
}
|
||||
cret := gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Status()
|
||||
|
||||
return handleFromPtr_gorrent_TorrentStatus(&cret)
|
||||
}
|
||||
|
||||
//export gorrent_Engine_FileStatus
|
||||
func gorrent_Engine_FileStatus(_handle CGoHandle, i C.longlong) CGoHandle {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return handleFromPtr_gorrent_FileStatus(nil)
|
||||
}
|
||||
cret, __err := gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).FileStatus(int(i))
|
||||
|
||||
if __err != nil {
|
||||
estr := C.CString(__err.Error())
|
||||
C.PyErr_SetString(C.PyExc_RuntimeError, estr)
|
||||
C.free(unsafe.Pointer(estr))
|
||||
return handleFromPtr_gorrent_FileStatus(nil)
|
||||
}
|
||||
return handleFromPtr_gorrent_FileStatus(&cret)
|
||||
}
|
||||
|
||||
//export gorrent_Engine_Stop
|
||||
func gorrent_Engine_Stop(_handle CGoHandle, goRun C.char) {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return
|
||||
}
|
||||
if boolPyToGo(goRun) {
|
||||
go gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Stop()
|
||||
} else {
|
||||
gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Stop()
|
||||
}
|
||||
}
|
||||
|
||||
//export gorrent_Engine_GetMsg
|
||||
func gorrent_Engine_GetMsg(_handle CGoHandle) *C.char {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return C.CString("")
|
||||
}
|
||||
return C.CString(gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).GetMsg())
|
||||
|
||||
}
|
||||
|
||||
//export gorrent_Engine_Clean
|
||||
func gorrent_Engine_Clean(_handle CGoHandle, goRun C.char) {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return
|
||||
}
|
||||
if boolPyToGo(goRun) {
|
||||
go gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Clean()
|
||||
} else {
|
||||
gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Clean()
|
||||
}
|
||||
}
|
||||
|
||||
// --- wrapping struct: gorrent.FileInfo ---
|
||||
//export gorrent_FileInfo_CTor
|
||||
func gorrent_FileInfo_CTor() CGoHandle {
|
||||
|
@ -1664,6 +1568,102 @@ func gorrent_TorrentStatus_Seeds_Set(handle CGoHandle, val C.longlong) {
|
|||
}
|
||||
|
||||
|
||||
// --- wrapping struct: gorrent.Engine ---
|
||||
//export gorrent_Engine_CTor
|
||||
func gorrent_Engine_CTor() CGoHandle {
|
||||
return CGoHandle(handleFromPtr_gorrent_Engine(&gorrent.Engine{}))
|
||||
}
|
||||
|
||||
//export gorrent_Engine_IsAlive
|
||||
func gorrent_Engine_IsAlive(_handle CGoHandle) C.char {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return boolGoToPy(false)
|
||||
}
|
||||
return boolGoToPy(gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).IsAlive())
|
||||
|
||||
}
|
||||
|
||||
//export gorrent_Engine_StartTorrent
|
||||
func gorrent_Engine_StartTorrent(_handle CGoHandle, idx C.longlong) *C.char {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return C.CString("")
|
||||
}
|
||||
__err = gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).StartTorrent(int(idx))
|
||||
|
||||
if __err != nil {
|
||||
estr := C.CString(__err.Error())
|
||||
C.PyErr_SetString(C.PyExc_RuntimeError, estr)
|
||||
return estr
|
||||
}
|
||||
return C.CString("")
|
||||
}
|
||||
|
||||
//export gorrent_Engine_Status
|
||||
func gorrent_Engine_Status(_handle CGoHandle) CGoHandle {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return handleFromPtr_gorrent_TorrentStatus(nil)
|
||||
}
|
||||
cret := gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Status()
|
||||
|
||||
return handleFromPtr_gorrent_TorrentStatus(&cret)
|
||||
}
|
||||
|
||||
//export gorrent_Engine_FileStatus
|
||||
func gorrent_Engine_FileStatus(_handle CGoHandle, i C.longlong) CGoHandle {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return handleFromPtr_gorrent_FileStatus(nil)
|
||||
}
|
||||
cret, __err := gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).FileStatus(int(i))
|
||||
|
||||
if __err != nil {
|
||||
estr := C.CString(__err.Error())
|
||||
C.PyErr_SetString(C.PyExc_RuntimeError, estr)
|
||||
C.free(unsafe.Pointer(estr))
|
||||
return handleFromPtr_gorrent_FileStatus(nil)
|
||||
}
|
||||
return handleFromPtr_gorrent_FileStatus(&cret)
|
||||
}
|
||||
|
||||
//export gorrent_Engine_Stop
|
||||
func gorrent_Engine_Stop(_handle CGoHandle, goRun C.char) {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return
|
||||
}
|
||||
if boolPyToGo(goRun) {
|
||||
go gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Stop()
|
||||
} else {
|
||||
gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Stop()
|
||||
}
|
||||
}
|
||||
|
||||
//export gorrent_Engine_GetMsg
|
||||
func gorrent_Engine_GetMsg(_handle CGoHandle) *C.char {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return C.CString("")
|
||||
}
|
||||
return C.CString(gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).GetMsg())
|
||||
|
||||
}
|
||||
|
||||
//export gorrent_Engine_Clean
|
||||
func gorrent_Engine_Clean(_handle CGoHandle, goRun C.char) {
|
||||
vifc, __err := gopyh.VarFromHandleTry((gopyh.CGoHandle)(_handle), "*gorrent.Engine")
|
||||
if __err != nil {
|
||||
return
|
||||
}
|
||||
if boolPyToGo(goRun) {
|
||||
go gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Clean()
|
||||
} else {
|
||||
gopyh.Embed(vifc, reflect.TypeOf(gorrent.Engine{})).(*gorrent.Engine).Clean()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---- Slices ---
|
||||
|
||||
|
@ -1673,12 +1673,6 @@ func gorrent_TorrentStatus_Seeds_Set(handle CGoHandle, val C.longlong) {
|
|||
|
||||
// ---- Constructors ---
|
||||
|
||||
//export gorrent_NewEngine
|
||||
func gorrent_NewEngine(settings CGoHandle) CGoHandle {
|
||||
return handleFromPtr_Ptr_gorrent_Engine(gorrent.NewEngine(ptrFromHandle_Ptr_gorrent_Settings(settings)))
|
||||
|
||||
}
|
||||
|
||||
//export gorrent_GetMetaFromFile
|
||||
func gorrent_GetMetaFromFile(path *C.char) CGoHandle {
|
||||
cret, __err := gorrent.GetMetaFromFile(C.GoString(path))
|
||||
|
@ -1698,6 +1692,12 @@ func gorrent_NewSettings() CGoHandle {
|
|||
|
||||
}
|
||||
|
||||
//export gorrent_NewEngine
|
||||
func gorrent_NewEngine(settings CGoHandle) CGoHandle {
|
||||
return handleFromPtr_Ptr_gorrent_Engine(gorrent.NewEngine(ptrFromHandle_Ptr_gorrent_Settings(settings)))
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---- Functions ---
|
||||
|
||||
|
|
|
@ -127,68 +127,6 @@ class Slice_Ptr_gorrent_FileInfo(go.GoClass):
|
|||
|
||||
# ---- Structs ---
|
||||
|
||||
# Python type for struct gorrent.Engine
|
||||
class Engine(go.GoClass):
|
||||
""""""
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
handle=A Go-side object is always initialized with an explicit handle=arg
|
||||
otherwise parameters can be unnamed in order of field names or named fields
|
||||
in which case a new Go object is constructed first
|
||||
"""
|
||||
if len(kwargs) == 1 and 'handle' in kwargs:
|
||||
self.handle = kwargs['handle']
|
||||
_gorrent.IncRef(self.handle)
|
||||
elif len(args) == 1 and isinstance(args[0], go.GoClass):
|
||||
self.handle = args[0].handle
|
||||
_gorrent.IncRef(self.handle)
|
||||
else:
|
||||
self.handle = _gorrent.gorrent_Engine_CTor()
|
||||
_gorrent.IncRef(self.handle)
|
||||
def __del__(self):
|
||||
_gorrent.DecRef(self.handle)
|
||||
def __str__(self):
|
||||
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
||||
sv = 'gorrent.Engine{'
|
||||
first = True
|
||||
for v in pr:
|
||||
if callable(v[1]):
|
||||
continue
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
sv += ', '
|
||||
sv += v[0] + '=' + str(v[1])
|
||||
return sv + '}'
|
||||
def __repr__(self):
|
||||
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
||||
sv = 'gorrent.Engine ( '
|
||||
for v in pr:
|
||||
if not callable(v[1]):
|
||||
sv += v[0] + '=' + str(v[1]) + ', '
|
||||
return sv + ')'
|
||||
def IsAlive(self):
|
||||
"""IsAlive() bool"""
|
||||
return _gorrent.gorrent_Engine_IsAlive(self.handle)
|
||||
def StartTorrent(self, idx):
|
||||
"""StartTorrent(int idx) str"""
|
||||
return _gorrent.gorrent_Engine_StartTorrent(self.handle, idx)
|
||||
def Status(self):
|
||||
"""Status() object"""
|
||||
return TorrentStatus(handle=_gorrent.gorrent_Engine_Status(self.handle))
|
||||
def FileStatus(self, i):
|
||||
"""FileStatus(int i) object, str"""
|
||||
return FileStatus(handle=_gorrent.gorrent_Engine_FileStatus(self.handle, i))
|
||||
def Stop(self, goRun=False):
|
||||
"""Stop() """
|
||||
_gorrent.gorrent_Engine_Stop(self.handle, goRun)
|
||||
def GetMsg(self):
|
||||
"""GetMsg() str"""
|
||||
return _gorrent.gorrent_Engine_GetMsg(self.handle)
|
||||
def Clean(self, goRun=False):
|
||||
"""Clean() """
|
||||
_gorrent.gorrent_Engine_Clean(self.handle, goRun)
|
||||
|
||||
# Python type for struct gorrent.FileInfo
|
||||
class FileInfo(go.GoClass):
|
||||
""""""
|
||||
|
@ -696,6 +634,68 @@ class TorrentStatus(go.GoClass):
|
|||
else:
|
||||
_gorrent.gorrent_TorrentStatus_Seeds_Set(self.handle, value)
|
||||
|
||||
# Python type for struct gorrent.Engine
|
||||
class Engine(go.GoClass):
|
||||
""""""
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
handle=A Go-side object is always initialized with an explicit handle=arg
|
||||
otherwise parameters can be unnamed in order of field names or named fields
|
||||
in which case a new Go object is constructed first
|
||||
"""
|
||||
if len(kwargs) == 1 and 'handle' in kwargs:
|
||||
self.handle = kwargs['handle']
|
||||
_gorrent.IncRef(self.handle)
|
||||
elif len(args) == 1 and isinstance(args[0], go.GoClass):
|
||||
self.handle = args[0].handle
|
||||
_gorrent.IncRef(self.handle)
|
||||
else:
|
||||
self.handle = _gorrent.gorrent_Engine_CTor()
|
||||
_gorrent.IncRef(self.handle)
|
||||
def __del__(self):
|
||||
_gorrent.DecRef(self.handle)
|
||||
def __str__(self):
|
||||
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
||||
sv = 'gorrent.Engine{'
|
||||
first = True
|
||||
for v in pr:
|
||||
if callable(v[1]):
|
||||
continue
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
sv += ', '
|
||||
sv += v[0] + '=' + str(v[1])
|
||||
return sv + '}'
|
||||
def __repr__(self):
|
||||
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
||||
sv = 'gorrent.Engine ( '
|
||||
for v in pr:
|
||||
if not callable(v[1]):
|
||||
sv += v[0] + '=' + str(v[1]) + ', '
|
||||
return sv + ')'
|
||||
def IsAlive(self):
|
||||
"""IsAlive() bool"""
|
||||
return _gorrent.gorrent_Engine_IsAlive(self.handle)
|
||||
def StartTorrent(self, idx):
|
||||
"""StartTorrent(int idx) str"""
|
||||
return _gorrent.gorrent_Engine_StartTorrent(self.handle, idx)
|
||||
def Status(self):
|
||||
"""Status() object"""
|
||||
return TorrentStatus(handle=_gorrent.gorrent_Engine_Status(self.handle))
|
||||
def FileStatus(self, i):
|
||||
"""FileStatus(int i) object, str"""
|
||||
return FileStatus(handle=_gorrent.gorrent_Engine_FileStatus(self.handle, i))
|
||||
def Stop(self, goRun=False):
|
||||
"""Stop() """
|
||||
_gorrent.gorrent_Engine_Stop(self.handle, goRun)
|
||||
def GetMsg(self):
|
||||
"""GetMsg() str"""
|
||||
return _gorrent.gorrent_Engine_GetMsg(self.handle)
|
||||
def Clean(self, goRun=False):
|
||||
"""Clean() """
|
||||
_gorrent.gorrent_Engine_Clean(self.handle, goRun)
|
||||
|
||||
|
||||
# ---- Slices ---
|
||||
|
||||
|
@ -704,15 +704,15 @@ class TorrentStatus(go.GoClass):
|
|||
|
||||
|
||||
# ---- Constructors ---
|
||||
def NewEngine(settings):
|
||||
"""NewEngine(object settings) object"""
|
||||
return Engine(handle=_gorrent.gorrent_NewEngine(settings.handle))
|
||||
def GetMetaFromFile(path):
|
||||
"""GetMetaFromFile(str path) object, str"""
|
||||
return Info(handle=_gorrent.gorrent_GetMetaFromFile(path))
|
||||
def NewSettings():
|
||||
"""NewSettings() object"""
|
||||
return Settings(handle=_gorrent.gorrent_NewSettings())
|
||||
def NewEngine(settings):
|
||||
"""NewEngine(object settings) object"""
|
||||
return Engine(handle=_gorrent.gorrent_NewEngine(settings.handle))
|
||||
|
||||
|
||||
# ---- Functions ---
|
||||
|
|
Loading…
Reference in New Issue