Merge pull request #17 from DiMartinoXBMC/master

merge from upstream
master
Роман 2018-09-11 12:54:03 +03:00 committed by GitHub
commit 1c213d304e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 850 additions and 2127 deletions

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,7 @@ class AnteoLoader:
keep_incomplete = True
dht_routers = ["router.bittorrent.com:6881", "router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)'
user_agent = ''
self.engine = Engine(uri=file_url(localize_path(self.torrentFile)), download_path=self.storageDirectory,
connections_limit=connections_limit,
encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete,
@ -285,6 +285,12 @@ class AnteoPlayer(xbmc.Player):
def __init__(self, userStorageDirectory, torrentUrl, params={}):
self.userStorageDirectory = userStorageDirectory
self.torrentUrl = torrentUrl
if not is_writable(self.userStorageDirectory):
xbmcgui.Dialog().ok(Localization.localize('Torrenter v2'),
Localization.localize('Your storage path is not writable or not local! Please change it in settings!'),
self.storageDirectory)
sys.exit(1)
xbmc.Player.__init__(self)
log("["+author+"Player] Initalized v"+__version__)
self.params = params
@ -380,7 +386,7 @@ class AnteoPlayer(xbmc.Player):
enable_dht = self.__settings__.getSetting("enable_dht") == 'true'
dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)'
user_agent = ''
self.pre_buffer_bytes = int(self.__settings__.getSetting("pre_buffer_bytes"))*1024*1024
self.engine = Engine(uri=file_url(self.torrentUrl), download_path=self.userStorageDirectory,
@ -662,7 +668,8 @@ class OverlayText(object):
self._shown = False
self._text = ""
self._label = xbmcgui.ControlLabel(x, y, w, h, self._text, *args, **kwargs)
self._background = xbmcgui.ControlImage(x, y, w, h, os.path.join(RESOURCES_PATH, "images", "black.png"))
filename = os.path.join(RESOURCES_PATH, "images", "black.png")
self._background = xbmcgui.ControlImage(x, y, w, h, filename)
self._background.setColorDiffuse("0xD0000000")
def show(self):
@ -696,5 +703,10 @@ class OverlayText(object):
skin_path = xbmc.translatePath("special://skin/")
tree = ET.parse(os.path.join(skin_path, "addon.xml"))
res = tree.findall("./extension/res")[0]
res = None
for element in tree.findall("./extension/res"):
if element.attrib["default"] == 'true':
res = element
break
if res is None: res = tree.findall("./extension/res")[0]
return int(res.attrib["width"]), int(res.attrib["height"])

View File

@ -24,8 +24,9 @@ proxy = int(sys.modules["__main__"].__settings__.getSetting("cl_proxy"))
if proxy == 1:
socks_ip = sys.modules["__main__"].__settings__.getSetting("socks_ip")
import socket
from resources import socks
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, socks_ip, 9050)
from resources.proxy import socks
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, socks_ip,
int(sys.modules["__main__"].__settings__.getSetting("socks_port")))
socket.socket = socks.socksocket
import urllib
import urllib2

48
Core.py
View File

@ -297,9 +297,17 @@ class Core:
def test(self, params={}):
pass
import searchwindow
params = {'mode': 'file_browser', 'path':'D:\\', 'tdir':'D:\\FRAPS\\'}
searchwindow.main(params)
xbmc.Player().play('D:\\filmz\\The Missing (2014).mp4')
from Anteoloader import OverlayText, OVERLAY_WIDTH, OVERLAY_HEIGHT, XBFONT_CENTER_X,XBFONT_CENTER_Y
overlay = OverlayText(w=OVERLAY_WIDTH, h=OVERLAY_HEIGHT,
alignment=XBFONT_CENTER_X | XBFONT_CENTER_Y)
overlay.show()
overlay.text = 'XXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxXXXXXXXXXXXXXXXXXX\r\n' \
'YYyyyYyYYyYyY'
time.sleep(5)
overlay.hide()
time.sleep(1)
xbmc.Player().stop()
def swHistory(self, params={}):
import searchwindow
@ -556,11 +564,9 @@ class Core:
if action2 == 'open':
filename, foldername, path, url, seek, length, ind = db.get('filename, foldername, path, url, seek, length, ind', 'addtime', str(addtime))
if os.path.exists(path) and os.path.getsize(path) > 0:
if os.path.exists(path):
self.__settings__.setSetting("lastTorrent", path)
else:
if os.path.exists(path):
os.unlink(path)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
path = torrent.saveTorrent(url)
self.__settings__.setSetting("lastTorrent", path)
@ -576,11 +582,9 @@ class Core:
seek = int(seek)
else:
seek = 0
if os.path.exists(path) and os.path.getsize(path) > 0:
if os.path.exists(path):
self.__settings__.setSetting("lastTorrent", path)
else:
if os.path.exists(path):
os.unlink(path)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url='+str(ind)+'&seek='+str(seek)+'")')
@ -1089,28 +1093,6 @@ class Core:
self.drawItem(title, 'downloadLibtorrent', link, image=img, info=info, contextMenu=contextMenu, replaceMenu=False)
#self.drawItem(title, 'openTorrent', link, img, info=info, contextMenu=contextMenu, replaceMenu=False)
def ActionInfo(self, params={}):
from resources.skins.DialogXml import DialogXml
get = params.get
contenter=get('provider')
infolink=get('url')
link=get('link')
if ROOT + os.sep + 'resources' + os.sep + 'contenters' not in sys.path:
sys.path.insert(0, ROOT + os.sep + 'resources' + os.sep + 'contenters')
try:
self.Content = getattr(__import__(contenter), contenter)()
except Exception, e:
log('Unable to use contenter: ' + contenter + ' at ' + ' ActionInfo(). Exception: ' + str(e))
movieInfo=self.Content.get_info(infolink)
if movieInfo:
w = DialogXml("movieinfo.xml", ROOT, "Default")
w.doModal(movieInfo, link)
del w
del movieInfo
else:
showMessage(self.localize('Information'),self.localize('Information not found!'))
def searchOption(self, params={}):
try:
apps = json.loads(urllib.unquote_plus(params.get("url")))
@ -1437,6 +1419,7 @@ class Core:
if not url:
action = xbmcgui.Dialog()
url = action.browse(1, self.localize('Choose .torrent in video library'), 'video', '.torrent')
url = urllib.quote_plus(url)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
self.__settings__.setSetting("lastTorrentUrl", url)
@ -1592,7 +1575,8 @@ class Core:
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
self.__settings__.setSetting("lastTorrent", url)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)
filename = torrent.saveTorrent(url)

View File

@ -140,7 +140,7 @@ class InposLoader:
enable_dht = self.__settings__.getSetting("enable_dht") == 'true'
dht_routers = ["router.bittorrent.com:6881", "router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)'
user_agent = ''
self.engine = Engine(uri=file_url(self.torrentFile), download_path=self.storageDirectory,
connections_limit=connections_limit,
encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete,
@ -253,6 +253,12 @@ class InposPlayer(xbmc.Player):
def __init__(self, userStorageDirectory, torrentUrl, params={}):
self.userStorageDirectory = userStorageDirectory
self.torrentUrl = torrentUrl
if not is_writable(self.userStorageDirectory):
xbmcgui.Dialog().ok(Localization.localize('Torrenter v2'),
Localization.localize('Your storage path is not writable or not local! Please change it in settings!'),
self.storageDirectory)
sys.exit(1)
xbmc.Player.__init__(self)
log("["+author+"Player] Initalized v"+__version__)
self.params = params
@ -369,7 +375,7 @@ class InposPlayer(xbmc.Player):
resume_file=os.path.join(self.userStorageDirectory, 'torrents', os.path.basename(self.torrentUrl)+'.resume_data')
dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)'
user_agent = ''
self.pre_buffer_bytes = int(self.__settings__.getSetting("pre_buffer_bytes"))*1024*1024
if self.__settings__.getSetting('debug') == 'true':
showMessage('[%sPlayer v%s] ' % (author, __version__), self.localize('Please Wait'))

View File

@ -30,7 +30,7 @@ import Downloader
import xbmcgui
import xbmcvfs
import Localization
from functions import calculate, showMessage, clearStorage, WatchedHistoryDB, DownloadDB, get_ids_video, log, debug, foldername, ensure_str, loadsw_onstop
from functions import calculate, showMessage, clearStorage, WatchedHistoryDB, DownloadDB, get_ids_video, log, debug, foldername, ensure_str, loadsw_onstop, decode_str
ROOT = sys.modules["__main__"].__root__
RESOURCES_PATH = os.path.join(ROOT, 'resources')
@ -388,10 +388,11 @@ class TorrentPlayer(xbmc.Player):
addition = os.path.dirname(title).lstrip(folder + os.sep).replace(os.sep, '.').replace(' ', '_').strip()
ext = temp.split('.')[-1]
temp = temp[:len(temp) - len(ext) - 1] + '.' + addition + '.' + ext
newFileName = os.path.join(os.path.dirname(path), temp)
debug('[setup_subs]: '+str((os.path.join(os.path.dirname(os.path.dirname(path)),title),newFileName)))
newFileName = os.path.join(ensure_str(os.path.dirname(decode_str(path))), ensure_str(temp))
debug('[setup_subs]: {} {}'.format(newFileName, title))
if not xbmcvfs.exists(newFileName):
xbmcvfs.copy(os.path.join(os.path.dirname(os.path.dirname(path)), title), newFileName)
fileName = os.path.join(ensure_str(os.path.dirname(os.path.dirname(decode_str(path)))), ensure_str(title))
xbmcvfs.copy(fileName, newFileName)
def onPlayBackStarted(self):
for f in self.on_playback_started:

View File

@ -30,8 +30,9 @@ import sys
proxy = int(sys.modules["__main__"].__settings__.getSetting("proxy"))
if proxy == 2:
socks_ip = sys.modules["__main__"].__settings__.getSetting("socks_ip")
from resources import socks
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, socks_ip, 9050)
from resources.proxy import socks
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, socks_ip,
int(sys.modules["__main__"].__settings__.getSetting("socks_port")))
socket.socket = socks.socksocket
import urllib
import urllib2

View File

@ -243,7 +243,7 @@ class SkorbaLoader:
return self.getContentList()[contentId]['size']
def getFilePath(self, contentId=0):
return os.path.join(self.storageDirectory, self.getContentList()[contentId]['title']) # .decode('utf8')
return os.path.join(self.storageDirectory, decode_str(self.getContentList()[contentId]['title']))
def getContentList(self):
filelist = []
@ -381,7 +381,7 @@ class SkorbaLoader:
session_settings['rate_limit_ip_overhead'] = True
session_settings['request_timeout'] = 1
session_settings['torrent_connect_boost'] = 50
session_settings['user_agent'] = 'uTorrent/2200(24683)'
session_settings['user_agent'] = ''
if pc_config == 0:
#good pc
session_settings['connections_limit'] = 200
@ -412,7 +412,7 @@ class SkorbaLoader:
session_settings.rate_limit_ip_overhead = True
session_settings.request_timeout = 1
session_settings.torrent_connect_boost = 100
session_settings.user_agent = 'uTorrent/2200(24683)'
session_settings.user_agent = ''
#
self.session.set_settings(session_settings)

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.torrenter" name="Torrenter" version="2.6.6" provider-name="inpos">
<addon id="plugin.video.torrenter" name="Torrenter" version="2.6.7" provider-name="inpos">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.libtorrent"/>

View File

@ -1,4 +1,10 @@
[B]Version 2.6.6[/B]
[B]Version 2.6.7[/B]
[+] Теперь можно указать порт SOCKS-прокси, при использоании прокси Tor
[+] Списки медиа: исправлен RiperAM
[+] .torrent Player: Исправлена работа c длинными названиями
[-] Удален user-agent "uTorrent/2200(24683)" во избежании бана
[B]Version 2.6.6[/B]
[+] Добавлена поддержка прокси для windows
[+] Теперь можно указать адрес SOCKS-прокси, при использоании прокси Tor

View File

@ -28,7 +28,7 @@ class RiperAM(Content.Content):
'hot': ('Most Recent', '/', {'page': '/portal.php?tp=%d', 'increase': 30, 'second_page': 30}),
}
baseurl = "http://bt.kubyshka.org"
baseurl = "http://riperam.org/"
headers = [('User-Agent',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124' + \
' YaBrowser/14.10.2062.12061 Safari/537.36'),

View File

@ -103,7 +103,7 @@ class RuTorOrg(Content.Content):
return False
def get_contentList(self, category, subcategory=None, apps_property=None):
self.debug = self.log
#self.debug = self.log
contentList = []
url = 'http://%s' % self.get_url(category, subcategory, apps_property)
self.debug(url)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 120 B

View File

@ -47,6 +47,7 @@
<string id="30047">Proxy for Search</string>
<string id="31047">Proxy for Content Lists</string>
<string id="32047">SOCKS-proxy IP</string>
<string id="32048">SOCKS-proxy Port</string>
<string id="30048">None</string>
<string id="30049">Anti-zapret</string>
<string id="31050">Tor</string>

View File

@ -47,6 +47,7 @@
<string id="30047">Прокси для поиска</string>
<string id="31047">Прокси для списков медиа</string>
<string id="32047">IP SOCKS-прокси</string>
<string id="32048">Порт SOCKS-прокси</string>
<string id="30048">Не использовать</string>
<string id="30049">Anti-zapret</string>
<string id="31050">Tor</string>

View File

@ -17,7 +17,7 @@
<string id="30017">Transperency (de slng)</string>
<string id="30018">Confluence (de DiMartino)</string>
<string id="30019">Confluence (de RussakHH)</string>
<string id="30020">Habilitar historial de búsquedas</string>
<string id="30020">Habilitar el historial de búsquedas</string>
<string id="30021">python-libtorrent</string>
<string id="30022">Ace Stream</string>
<string id="30023">Reproductor P2P</string>
@ -44,11 +44,9 @@
<string id="30044">Guardar archivos</string>
<string id="30045">Preguntar para guardar</string>
<string id="30046">Torrent2HTTP (libtorrent vía HTTP)</string>
<string id="30047">Proxy para búsquedas</string>
<string id="31047">Proxy para listas de contenido</string>
<string id="32047">Dirección IP de proxy SOCKS</string>
<string id="30047">Proxy</string>
<string id="30048">Ninguno</string>
<string id="30049">Anti-zapret (antirrestricción)</string>
<string id="30049">Anti-zapret (antirestricción)</string>
<string id="31050">Tor</string>
<string id="30050">Inmunidad</string>
<string id="30051">Núm. máx. de conexiones (0 = ilimitadas)</string>
@ -60,12 +58,12 @@
<string id="30057">Promedio/Buen PC</string>
<string id="30058">Por debajo de la media, PC/router</string>
<string id="30059">Tamaño mínimo de almacenaje para autoborrado (GB)</string>
<string id="30060">Diferir inicio de reproductor</string>
<string id="30060">Diferir inicio del reproductor</string>
<string id="30061">Ordenar resultados de la búsqueda</string>
<string id="30062">Por fuentes</string>
<string id="30063">No ordenar</string>
<string id="30064">Por nombre</string>
<string id="30065">Añadir a historial de vistos después del (%)</string>
<string id="30065">Añadir al historial de vistos después del (%)</string>
<string id="30066">Confluence (de safonov_ivan)</string>
<string id="30067">Aeon Nox (de joyrider)</string>
<string id="30068">pyrrent2http (python-libtorrent vía HTTP)</string>
@ -101,7 +99,7 @@
<string id="50316">Contraseña</string>
<string id="50311">Cliente de BitTorrent</string>
<string id="50317">URL (no SSL)</string>
<string id="30426">Sustitución de ruta (solo remoto)</string>
<string id="30426">Sustitución de ruta (Solo remoto)</string>
<string id="30412">Cerrar</string>
<string id="30413">Abrir "Ajustes"</string>
<string id="30414">Navegador de cliente BitTorrent</string>

View File

@ -67,7 +67,7 @@ from base64 import b64encode
if os.name == "nt" and sys.version_info < (3, 0):
try:
from resources import win_inet_pton
from resources.proxy import win_inet_pton
except ImportError:
raise ImportError("To run PySocks on Windows you must install win_inet_pton")

View File

@ -13,8 +13,9 @@
<setting id="search_phrase" type="text" label="30040"/>
<setting id="num_threads" type="slider" label="30042" default="3" range="1,1,9" option="int"/>
<setting id="proxy" type="enum" lvalues="30048|30049|31050" label="30047" default="0"/>
<setting id="cl_proxy" type="enum" lvalues="30048|31050" label="31047" default="0"/>
<setting id="cl_proxy" type="enum" lvalues="30048|31050" label="31047" default="0"/>
<setting id="socks_ip" type="ipaddress" label="32047" default="127.0.0.1" visible="eq(-2,2)|eq(-1,1)"/>
<setting id="socks_port" type="number" label="32048" default="9050" visible="eq(-3,2)|eq(-2,1)"/>
<setting id="debug" type="bool" label="30015" default="false"/>
</category>
<category label="30102">

View File

@ -1270,8 +1270,6 @@ class InfoWindow(pyxbmct.AddonDialogWindow):
# self.set_navigation()
def set_controls(self):
# pyxbmct.AddonWindow().setImage(__root__ + '/resources/skins/Default/media/ConfluenceDialogBack.png')
# self.placeControl(self.background, 0, 0, rowspan=3, columnspan=2)
self.listing = pyxbmct.List(_imageWidth=30, _imageHeight=30, _itemTextXOffset=1,
_itemTextYOffset=0, _itemHeight=30, _space=0, _alignmentY=0)
self.placeControl(self.listing, 0, 1, 2, 2)