724 lines
22 KiB
Python
724 lines
22 KiB
Python
|
|
# python wrapper for package gorrent within overall package gorrent
|
|
# This is what you import to use the package.
|
|
# File is generated by gopy. Do not edit.
|
|
# gopy gen --output=py/gorrent gorrent
|
|
|
|
# the following is required to enable dlopen to open the _go.so file
|
|
import os,sys,inspect,collections
|
|
try:
|
|
import collections.abc as _collections_abc
|
|
except ImportError:
|
|
_collections_abc = collections
|
|
|
|
cwd = os.getcwd()
|
|
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
|
os.chdir(currentdir)
|
|
from . import _gorrent
|
|
from . import go
|
|
|
|
os.chdir(cwd)
|
|
|
|
# to use this code in your end-user python file, import it as follows:
|
|
# from gorrent import gorrent
|
|
# and then refer to everything using gorrent. prefix
|
|
# packages imported by this package listed below:
|
|
|
|
|
|
|
|
|
|
# ---- Types ---
|
|
|
|
# Python type for slice []*gorrent.FileInfo
|
|
class Slice_Ptr_gorrent_FileInfo(go.GoClass):
|
|
""""""
|
|
def __init__(self, *args, **kwargs):
|
|
"""
|
|
handle=A Go-side object is always initialized with an explicit handle=arg
|
|
otherwise parameter is a python list that we copy from
|
|
"""
|
|
self.index = 0
|
|
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.Slice_Ptr_gorrent_FileInfo_CTor()
|
|
_gorrent.IncRef(self.handle)
|
|
if len(args) > 0:
|
|
if not isinstance(args[0], _collections_abc.Iterable):
|
|
raise TypeError('Slice_Ptr_gorrent_FileInfo.__init__ takes a sequence as argument')
|
|
for elt in args[0]:
|
|
self.append(elt)
|
|
def __del__(self):
|
|
_gorrent.DecRef(self.handle)
|
|
def __str__(self):
|
|
s = 'gorrent.Slice_Ptr_gorrent_FileInfo len: ' + str(len(self)) + ' handle: ' + str(self.handle) + ' ['
|
|
if len(self) < 120:
|
|
s += ', '.join(map(str, self)) + ']'
|
|
return s
|
|
def __repr__(self):
|
|
return 'gorrent.Slice_Ptr_gorrent_FileInfo([' + ', '.join(map(str, self)) + '])'
|
|
def __len__(self):
|
|
return _gorrent.Slice_Ptr_gorrent_FileInfo_len(self.handle)
|
|
def __getitem__(self, key):
|
|
if isinstance(key, slice):
|
|
if key.step == None or key.step == 1:
|
|
st = key.start
|
|
ed = key.stop
|
|
if st == None:
|
|
st = 0
|
|
if ed == None:
|
|
ed = _gorrent.Slice_Ptr_gorrent_FileInfo_len(self.handle)
|
|
return Slice_Ptr_gorrent_FileInfo(handle=_gorrent.Slice_Ptr_gorrent_FileInfo_subslice(self.handle, st, ed))
|
|
return [self[ii] for ii in range(*key.indices(len(self)))]
|
|
elif isinstance(key, int):
|
|
if key < 0:
|
|
key += len(self)
|
|
if key < 0 or key >= len(self):
|
|
raise IndexError('slice index out of range')
|
|
return FileInfo(handle=_gorrent.Slice_Ptr_gorrent_FileInfo_elem(self.handle, key))
|
|
else:
|
|
raise TypeError('slice index invalid type')
|
|
def __setitem__(self, idx, value):
|
|
if idx < 0:
|
|
idx += len(self)
|
|
if idx < len(self):
|
|
_gorrent.Slice_Ptr_gorrent_FileInfo_set(self.handle, idx, value.handle)
|
|
return
|
|
raise IndexError('slice index out of range')
|
|
def __iadd__(self, value):
|
|
if not isinstance(value, _collections_abc.Iterable):
|
|
raise TypeError('Slice_Ptr_gorrent_FileInfo.__iadd__ takes a sequence as argument')
|
|
for elt in value:
|
|
self.append(elt)
|
|
return self
|
|
def __iter__(self):
|
|
self.index = 0
|
|
return self
|
|
def __next__(self):
|
|
if self.index < len(self):
|
|
rv = _gorrent.Slice_Ptr_gorrent_FileInfo_elem(self.handle, self.index)
|
|
self.index = self.index + 1
|
|
return rv
|
|
raise StopIteration
|
|
def append(self, value):
|
|
_gorrent.Slice_Ptr_gorrent_FileInfo_append(self.handle, value.handle)
|
|
def copy(self, src):
|
|
""" copy emulates the go copy function, copying elements into this list from source list, up to min of size of each list """
|
|
mx = min(len(self), len(src))
|
|
for i in range(mx):
|
|
self[i] = src[i]
|
|
|
|
|
|
#---- Enums from Go (collections of consts with same type) ---
|
|
|
|
|
|
#---- Constants from Go: Python can only ask that you please don't change these! ---
|
|
|
|
|
|
# ---- Global Variables: can only use functions to access ---
|
|
|
|
|
|
# ---- Interfaces ---
|
|
|
|
|
|
# ---- Structs ---
|
|
|
|
# Python type for struct gorrent.FileStatus
|
|
class FileStatus(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_FileStatus_CTor()
|
|
_gorrent.IncRef(self.handle)
|
|
if 0 < len(args):
|
|
self.Name = args[0]
|
|
if "Name" in kwargs:
|
|
self.Name = kwargs["Name"]
|
|
if 1 < len(args):
|
|
self.Url = args[1]
|
|
if "Url" in kwargs:
|
|
self.Url = kwargs["Url"]
|
|
if 2 < len(args):
|
|
self.Progress = args[2]
|
|
if "Progress" in kwargs:
|
|
self.Progress = kwargs["Progress"]
|
|
if 3 < len(args):
|
|
self.Length = args[3]
|
|
if "Length" in kwargs:
|
|
self.Length = kwargs["Length"]
|
|
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.FileStatus{'
|
|
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.FileStatus ( '
|
|
for v in pr:
|
|
if not callable(v[1]):
|
|
sv += v[0] + '=' + str(v[1]) + ', '
|
|
return sv + ')'
|
|
@property
|
|
def Name(self):
|
|
return _gorrent.gorrent_FileStatus_Name_Get(self.handle)
|
|
@Name.setter
|
|
def Name(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileStatus_Name_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_FileStatus_Name_Set(self.handle, value)
|
|
@property
|
|
def Url(self):
|
|
return _gorrent.gorrent_FileStatus_Url_Get(self.handle)
|
|
@Url.setter
|
|
def Url(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileStatus_Url_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_FileStatus_Url_Set(self.handle, value)
|
|
@property
|
|
def Progress(self):
|
|
return _gorrent.gorrent_FileStatus_Progress_Get(self.handle)
|
|
@Progress.setter
|
|
def Progress(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileStatus_Progress_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_FileStatus_Progress_Set(self.handle, value)
|
|
@property
|
|
def Length(self):
|
|
return _gorrent.gorrent_FileStatus_Length_Get(self.handle)
|
|
@Length.setter
|
|
def Length(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileStatus_Length_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_FileStatus_Length_Set(self.handle, value)
|
|
|
|
# Python type for struct gorrent.Info
|
|
class Info(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_Info_CTor()
|
|
_gorrent.IncRef(self.handle)
|
|
if 0 < len(args):
|
|
self.Name = args[0]
|
|
if "Name" in kwargs:
|
|
self.Name = kwargs["Name"]
|
|
if 1 < len(args):
|
|
self.Length = args[1]
|
|
if "Length" in kwargs:
|
|
self.Length = kwargs["Length"]
|
|
if 2 < len(args):
|
|
self.Source = args[2]
|
|
if "Source" in kwargs:
|
|
self.Source = kwargs["Source"]
|
|
if 3 < len(args):
|
|
self.Files = args[3]
|
|
if "Files" in kwargs:
|
|
self.Files = kwargs["Files"]
|
|
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.Info{'
|
|
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.Info ( '
|
|
for v in pr:
|
|
if not callable(v[1]):
|
|
sv += v[0] + '=' + str(v[1]) + ', '
|
|
return sv + ')'
|
|
@property
|
|
def Name(self):
|
|
return _gorrent.gorrent_Info_Name_Get(self.handle)
|
|
@Name.setter
|
|
def Name(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Info_Name_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Info_Name_Set(self.handle, value)
|
|
@property
|
|
def Length(self):
|
|
return _gorrent.gorrent_Info_Length_Get(self.handle)
|
|
@Length.setter
|
|
def Length(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Info_Length_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Info_Length_Set(self.handle, value)
|
|
@property
|
|
def Source(self):
|
|
return _gorrent.gorrent_Info_Source_Get(self.handle)
|
|
@Source.setter
|
|
def Source(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Info_Source_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Info_Source_Set(self.handle, value)
|
|
@property
|
|
def Files(self):
|
|
return Slice_Ptr_gorrent_FileInfo(handle=_gorrent.gorrent_Info_Files_Get(self.handle))
|
|
@Files.setter
|
|
def Files(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Info_Files_Set(self.handle, value.handle)
|
|
else:
|
|
raise TypeError("supplied argument type {t} is not a go.GoClass".format(t=type(value)))
|
|
def LoadFile(self, path):
|
|
"""LoadFile(str path) str"""
|
|
return _gorrent.gorrent_Info_LoadFile(self.handle, path)
|
|
|
|
# Python type for struct gorrent.Settings
|
|
class Settings(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_Settings_CTor()
|
|
_gorrent.IncRef(self.handle)
|
|
if 0 < len(args):
|
|
self.DownloadPath = args[0]
|
|
if "DownloadPath" in kwargs:
|
|
self.DownloadPath = kwargs["DownloadPath"]
|
|
if 1 < len(args):
|
|
self.HttpBindHost = args[1]
|
|
if "HttpBindHost" in kwargs:
|
|
self.HttpBindHost = kwargs["HttpBindHost"]
|
|
if 2 < len(args):
|
|
self.HttpBindPort = args[2]
|
|
if "HttpBindPort" in kwargs:
|
|
self.HttpBindPort = kwargs["HttpBindPort"]
|
|
if 3 < len(args):
|
|
self.ListenPort = args[3]
|
|
if "ListenPort" in kwargs:
|
|
self.ListenPort = kwargs["ListenPort"]
|
|
if 4 < len(args):
|
|
self.MaxConnections = args[4]
|
|
if "MaxConnections" in kwargs:
|
|
self.MaxConnections = kwargs["MaxConnections"]
|
|
if 5 < len(args):
|
|
self.TorrentPath = args[5]
|
|
if "TorrentPath" in kwargs:
|
|
self.TorrentPath = kwargs["TorrentPath"]
|
|
if 6 < len(args):
|
|
self.Proxy = args[6]
|
|
if "Proxy" in kwargs:
|
|
self.Proxy = kwargs["Proxy"]
|
|
if 7 < len(args):
|
|
self.KeepFiles = args[7]
|
|
if "KeepFiles" in kwargs:
|
|
self.KeepFiles = kwargs["KeepFiles"]
|
|
if 8 < len(args):
|
|
self.Debug = args[8]
|
|
if "Debug" in kwargs:
|
|
self.Debug = kwargs["Debug"]
|
|
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.Settings{'
|
|
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.Settings ( '
|
|
for v in pr:
|
|
if not callable(v[1]):
|
|
sv += v[0] + '=' + str(v[1]) + ', '
|
|
return sv + ')'
|
|
@property
|
|
def DownloadPath(self):
|
|
return _gorrent.gorrent_Settings_DownloadPath_Get(self.handle)
|
|
@DownloadPath.setter
|
|
def DownloadPath(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_DownloadPath_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_DownloadPath_Set(self.handle, value)
|
|
@property
|
|
def HttpBindHost(self):
|
|
return _gorrent.gorrent_Settings_HttpBindHost_Get(self.handle)
|
|
@HttpBindHost.setter
|
|
def HttpBindHost(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_HttpBindHost_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_HttpBindHost_Set(self.handle, value)
|
|
@property
|
|
def HttpBindPort(self):
|
|
return _gorrent.gorrent_Settings_HttpBindPort_Get(self.handle)
|
|
@HttpBindPort.setter
|
|
def HttpBindPort(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_HttpBindPort_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_HttpBindPort_Set(self.handle, value)
|
|
@property
|
|
def ListenPort(self):
|
|
return _gorrent.gorrent_Settings_ListenPort_Get(self.handle)
|
|
@ListenPort.setter
|
|
def ListenPort(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_ListenPort_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_ListenPort_Set(self.handle, value)
|
|
@property
|
|
def MaxConnections(self):
|
|
return _gorrent.gorrent_Settings_MaxConnections_Get(self.handle)
|
|
@MaxConnections.setter
|
|
def MaxConnections(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_MaxConnections_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_MaxConnections_Set(self.handle, value)
|
|
@property
|
|
def TorrentPath(self):
|
|
return _gorrent.gorrent_Settings_TorrentPath_Get(self.handle)
|
|
@TorrentPath.setter
|
|
def TorrentPath(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_TorrentPath_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_TorrentPath_Set(self.handle, value)
|
|
@property
|
|
def Proxy(self):
|
|
return _gorrent.gorrent_Settings_Proxy_Get(self.handle)
|
|
@Proxy.setter
|
|
def Proxy(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_Proxy_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_Proxy_Set(self.handle, value)
|
|
@property
|
|
def KeepFiles(self):
|
|
return _gorrent.gorrent_Settings_KeepFiles_Get(self.handle)
|
|
@KeepFiles.setter
|
|
def KeepFiles(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_KeepFiles_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_KeepFiles_Set(self.handle, value)
|
|
@property
|
|
def Debug(self):
|
|
return _gorrent.gorrent_Settings_Debug_Get(self.handle)
|
|
@Debug.setter
|
|
def Debug(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_Settings_Debug_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_Settings_Debug_Set(self.handle, value)
|
|
|
|
# Python type for struct gorrent.TorrentStatus
|
|
class TorrentStatus(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_TorrentStatus_CTor()
|
|
_gorrent.IncRef(self.handle)
|
|
if 0 < len(args):
|
|
self.DownloadRate = args[0]
|
|
if "DownloadRate" in kwargs:
|
|
self.DownloadRate = kwargs["DownloadRate"]
|
|
if 1 < len(args):
|
|
self.UploadRate = args[1]
|
|
if "UploadRate" in kwargs:
|
|
self.UploadRate = kwargs["UploadRate"]
|
|
if 2 < len(args):
|
|
self.Seeds = args[2]
|
|
if "Seeds" in kwargs:
|
|
self.Seeds = kwargs["Seeds"]
|
|
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.TorrentStatus{'
|
|
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.TorrentStatus ( '
|
|
for v in pr:
|
|
if not callable(v[1]):
|
|
sv += v[0] + '=' + str(v[1]) + ', '
|
|
return sv + ')'
|
|
@property
|
|
def DownloadRate(self):
|
|
return _gorrent.gorrent_TorrentStatus_DownloadRate_Get(self.handle)
|
|
@DownloadRate.setter
|
|
def DownloadRate(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_TorrentStatus_DownloadRate_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_TorrentStatus_DownloadRate_Set(self.handle, value)
|
|
@property
|
|
def UploadRate(self):
|
|
return _gorrent.gorrent_TorrentStatus_UploadRate_Get(self.handle)
|
|
@UploadRate.setter
|
|
def UploadRate(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_TorrentStatus_UploadRate_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_TorrentStatus_UploadRate_Set(self.handle, value)
|
|
@property
|
|
def Seeds(self):
|
|
return _gorrent.gorrent_TorrentStatus_Seeds_Get(self.handle)
|
|
@Seeds.setter
|
|
def Seeds(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_TorrentStatus_Seeds_Set(self.handle, value.handle)
|
|
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)
|
|
|
|
# Python type for struct gorrent.FileInfo
|
|
class FileInfo(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_FileInfo_CTor()
|
|
_gorrent.IncRef(self.handle)
|
|
if 0 < len(args):
|
|
self.Length = args[0]
|
|
if "Length" in kwargs:
|
|
self.Length = kwargs["Length"]
|
|
if 1 < len(args):
|
|
self.Path = args[1]
|
|
if "Path" in kwargs:
|
|
self.Path = kwargs["Path"]
|
|
if 2 < len(args):
|
|
self.PathUTF8 = args[2]
|
|
if "PathUTF8" in kwargs:
|
|
self.PathUTF8 = kwargs["PathUTF8"]
|
|
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.FileInfo{'
|
|
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.FileInfo ( '
|
|
for v in pr:
|
|
if not callable(v[1]):
|
|
sv += v[0] + '=' + str(v[1]) + ', '
|
|
return sv + ')'
|
|
@property
|
|
def Length(self):
|
|
return _gorrent.gorrent_FileInfo_Length_Get(self.handle)
|
|
@Length.setter
|
|
def Length(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileInfo_Length_Set(self.handle, value.handle)
|
|
else:
|
|
_gorrent.gorrent_FileInfo_Length_Set(self.handle, value)
|
|
@property
|
|
def Path(self):
|
|
return go.Slice_string(handle=_gorrent.gorrent_FileInfo_Path_Get(self.handle))
|
|
@Path.setter
|
|
def Path(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileInfo_Path_Set(self.handle, value.handle)
|
|
else:
|
|
raise TypeError("supplied argument type {t} is not a go.GoClass".format(t=type(value)))
|
|
@property
|
|
def PathUTF8(self):
|
|
return go.Slice_string(handle=_gorrent.gorrent_FileInfo_PathUTF8_Get(self.handle))
|
|
@PathUTF8.setter
|
|
def PathUTF8(self, value):
|
|
if isinstance(value, go.GoClass):
|
|
_gorrent.gorrent_FileInfo_PathUTF8_Set(self.handle, value.handle)
|
|
else:
|
|
raise TypeError("supplied argument type {t} is not a go.GoClass".format(t=type(value)))
|
|
|
|
|
|
# ---- Slices ---
|
|
|
|
|
|
# ---- Maps ---
|
|
|
|
|
|
# ---- Constructors ---
|
|
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 ---
|
|
def Version():
|
|
"""Version() str"""
|
|
return _gorrent.gorrent_Version()
|
|
|
|
|