diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a44ecb2..172852c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,10 +1,14 @@
-
+
-
+
+
+
+
+
@@ -46,56 +50,59 @@
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -149,7 +156,7 @@
-
+
@@ -177,7 +184,7 @@
-
+
@@ -232,55 +239,73 @@
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -355,15 +380,15 @@
-
-
-
-
-
+
+
+
+
+
@@ -398,6 +423,7 @@
+
@@ -494,7 +520,6 @@
-
@@ -677,12 +702,6 @@
1420801533300
-
- 1437265540394
-
-
- 1437265540394
-
1437296216076
@@ -971,31 +990,37 @@
1450376961709
-
+
+ 1450377825654
+
+
+ 1450377825654
+
+
-
+
-
-
-
+
+
+
@@ -1012,7 +1037,6 @@
-
@@ -1037,7 +1061,8 @@
-
+
+
@@ -1300,7 +1325,6 @@
-
@@ -1337,57 +1361,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1423,7 +1406,7 @@
-
+
@@ -1449,7 +1432,7 @@
-
+
@@ -1484,94 +1467,125 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Anteoloader.py b/Anteoloader.py
index 39a12fa..ac55d57 100644
--- a/Anteoloader.py
+++ b/Anteoloader.py
@@ -88,6 +88,8 @@ class AnteoLoader:
magnetLink = None
engine = None
torrentFile = None
+ __plugin__ = sys.modules["__main__"].__plugin__
+ __settings__ = sys.modules["__main__"].__settings__
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
self.storageDirectory = storageDirectory
@@ -113,6 +115,32 @@ class AnteoLoader:
self.engine.close()
log('__exit__ worked!')
+ def setup_engine(self):
+ encryption = Encryption.ENABLED if self.__settings__.getSetting('encryption') == 'true' else Encryption.DISABLED
+
+ if self.__settings__.getSetting("connections_limit") not in ["",0,"0"]:
+ connections_limit = int(self.__settings__.getSetting("connections_limit"))
+ else:
+ connections_limit = None
+
+ use_random_port = True if self.__settings__.getSetting('use_random_port') == 'true' else False
+
+ listen_port=int(self.__settings__.getSetting("listen_port")) if self.__settings__.getSetting(
+ "listen_port") != "" else 6881
+
+ if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory:
+ keep_complete = False
+ keep_incomplete = False
+ else:
+ keep_complete = True
+ keep_incomplete = True
+
+ dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"]
+ self.engine = Engine(uri=self.torrentFile, download_path=self.storageDirectory,
+ connections_limit=connections_limit,
+ encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete,
+ dht_routers=dht_routers, use_random_port=use_random_port, listen_port=listen_port)
+
def localize(self, string):
try:
return Localization.localize(string)
@@ -120,7 +148,7 @@ class AnteoLoader:
return string
def getContentList(self):
- self.engine = Engine(uri=self.torrentFile)
+ self.setup_engine()
files = []
filelist = []
with closing(self.engine):
@@ -295,6 +323,9 @@ class AnteoPlayer(xbmc.Player):
use_random_port = True if self.__settings__.getSetting('use_random_port') == 'true' else False
+ listen_port=int(self.__settings__.getSetting("listen_port")) if self.__settings__.getSetting(
+ "listen_port") != "" else 6881
+
if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory:
keep_complete = False
keep_incomplete = False
@@ -306,7 +337,7 @@ class AnteoPlayer(xbmc.Player):
self.engine = Engine(uri=self.torrentUrl, download_path=self.userStorageDirectory,
connections_limit=connections_limit, download_kbps=download_limit, upload_kbps=upload_limit,
encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete,
- dht_routers=dht_routers, use_random_port=use_random_port)
+ dht_routers=dht_routers, use_random_port=use_random_port, listen_port=listen_port)
def buffer(self):
self.pre_buffer_bytes = 30*1024*1024 #30 MB
diff --git a/Core.py b/Core.py
index 1848d22..afe98b3 100644
--- a/Core.py
+++ b/Core.py
@@ -55,7 +55,7 @@ class Core:
if self.__settings__.getSetting('plugin_name') != self.__plugin__:
#Every update run
self.__settings__.setSetting('plugin_name', self.__plugin__)
- check_network_advancedsettings()
+ #check_network_advancedsettings()
check_download_dir()
if self.__plugin__ == 'Torrenter v.2.3.7':
#first_run_231()
diff --git a/addon.xml b/addon.xml
index ecf42cf..e2ee3a7 100644
--- a/addon.xml
+++ b/addon.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml
index ed936e5..f59430e 100644
--- a/resources/language/English/strings.xml
+++ b/resources/language/English/strings.xml
@@ -50,6 +50,7 @@
Immunicity
Max. connections (0 - unlimited)
Use random ports
+ Port for incominc connections
Interface
P2P Network
Advanced
diff --git a/resources/language/Russian/strings.xml b/resources/language/Russian/strings.xml
index 638ff80..7e55c2e 100644
--- a/resources/language/Russian/strings.xml
+++ b/resources/language/Russian/strings.xml
@@ -50,6 +50,7 @@
Immunicity
Макс. соединений (0 - безлимит)
Использовать случайные порты
+ Порт для входящих соединений
Интерфейс
P2P Сеть
Дополнительные
diff --git a/resources/settings.xml b/resources/settings.xml
index ecf0f3a..57fd2d9 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -27,7 +27,8 @@
-
+
+