magnet, platform
parent
cb7f1af5a5
commit
30df420b4f
71
Core.py
71
Core.py
|
@ -1673,40 +1673,47 @@ class Core:
|
||||||
self.__settings__.setSetting("lastTorrentUrl", url)
|
self.__settings__.setSetting("lastTorrentUrl", url)
|
||||||
classMatch = re.search('(\w+)::(.+)', url)
|
classMatch = re.search('(\w+)::(.+)', url)
|
||||||
if classMatch:
|
if classMatch:
|
||||||
searcher = classMatch.group(1)
|
print str(dirname)+str(re.match("^magnet\:.+$", classMatch.group(2))==None)
|
||||||
if self.ROOT + os.sep + 'resources' + os.sep + 'searchers' not in sys.path:
|
if re.match("^magnet\:.+$", classMatch.group(2)) and dirname:
|
||||||
sys.path.insert(0, self.ROOT + os.sep + 'resources' + os.sep + 'searchers')
|
url=classMatch.group(2)
|
||||||
try:
|
|
||||||
searcherObject = getattr(__import__(searcher), searcher)()
|
|
||||||
except Exception, e:
|
|
||||||
print 'Unable to use searcher: ' + searcher + ' at ' + self.__plugin__ + ' openTorrent(). Exception: ' + str(e)
|
|
||||||
return
|
|
||||||
url = searcherObject.getTorrentFile(classMatch.group(2))
|
|
||||||
|
|
||||||
torrent = Downloader.Torrent(self.userStorageDirectory,
|
|
||||||
torrentFilesDirectory=self.torrentFilesDirectory)
|
|
||||||
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
|
|
||||||
torrentFilesDirectory=self.torrentFilesDirectory)
|
|
||||||
|
|
||||||
if re.match("^magnet\:.+$", url):
|
|
||||||
if not dirname:
|
|
||||||
torrent.magnetToTorrent(url)
|
|
||||||
url = torrent.torrentFile
|
|
||||||
else:
|
|
||||||
Download().add_url(url, dirname)
|
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
url = torrent.saveTorrent(url)
|
searcher = classMatch.group(1)
|
||||||
|
if self.ROOT + os.sep + 'resources' + os.sep + 'searchers' not in sys.path:
|
||||||
|
sys.path.insert(0, self.ROOT + os.sep + 'resources' + os.sep + 'searchers')
|
||||||
|
try:
|
||||||
|
searcherObject = getattr(__import__(searcher), searcher)()
|
||||||
|
except Exception, e:
|
||||||
|
print 'Unable to use searcher: ' + searcher + ' at ' + self.__plugin__ + ' openTorrent(). Exception: ' + str(e)
|
||||||
|
return
|
||||||
|
url = searcherObject.getTorrentFile(classMatch.group(2))
|
||||||
|
|
||||||
f = open(url, 'rb')
|
torrent = Downloader.Torrent(self.userStorageDirectory,
|
||||||
torrent = f.read()
|
torrentFilesDirectory=self.torrentFilesDirectory)
|
||||||
f.close()
|
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
|
||||||
success = Download().add(torrent, dirname)
|
torrentFilesDirectory=self.torrentFilesDirectory)
|
||||||
if success:
|
|
||||||
showMessage(self.localize('Torrent-client Browser'), self.localize('Added!'), forced=True)
|
if re.match("^magnet\:.+$", url):
|
||||||
if ind:
|
if not dirname:
|
||||||
id = self.chooseHASH()[0]
|
torrent.magnetToTorrent(url)
|
||||||
Download().setprio(id, ind)
|
url = torrent.torrentFile
|
||||||
|
else:
|
||||||
|
success = Download().add_url(url, dirname)
|
||||||
|
if success:
|
||||||
|
showMessage(self.localize('Torrent-client Browser'), self.localize('Added!'), forced=True)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
url = torrent.saveTorrent(url)
|
||||||
|
|
||||||
|
if url:
|
||||||
|
f = open(url, 'rb')
|
||||||
|
torrent = f.read()
|
||||||
|
f.close()
|
||||||
|
success = Download().add(torrent, dirname)
|
||||||
|
if success:
|
||||||
|
showMessage(self.localize('Torrent-client Browser'), self.localize('Added!'), forced=True)
|
||||||
|
if ind:
|
||||||
|
id = self.chooseHASH()[0]
|
||||||
|
Download().setprio(id, ind)
|
||||||
|
|
||||||
def downloadLibtorrent(self, params={}):
|
def downloadLibtorrent(self, params={}):
|
||||||
get = params.get
|
get = params.get
|
||||||
|
|
|
@ -25,7 +25,7 @@ import urllib2
|
||||||
import hashlib
|
import hashlib
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import platform
|
from platform import get_platform
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import gzip
|
import gzip
|
||||||
from functions import file_decode, file_encode, isSubtitle, DownloadDB
|
from functions import file_decode, file_encode, isSubtitle, DownloadDB
|
||||||
|
@ -35,7 +35,6 @@ import xbmcgui
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
import Localization
|
import Localization
|
||||||
|
|
||||||
|
|
||||||
class Libtorrent:
|
class Libtorrent:
|
||||||
torrentFile = None
|
torrentFile = None
|
||||||
magnetLink = None
|
magnetLink = None
|
||||||
|
@ -73,7 +72,7 @@ class Libtorrent:
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Error importing python_libtorrent. Exception: ' + str(e)
|
print 'Error importing python_libtorrent. Exception: ' + str(e)
|
||||||
|
|
||||||
print 'Imported libtorrent v' + libtorrent.version + ' from ctypes.'''''
|
print 'Imported libtorrent v' + libtorrent.version + ' from ctypes.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libtorrent
|
import libtorrent
|
||||||
|
@ -101,10 +100,36 @@ class Libtorrent:
|
||||||
print 'Error importing python_libtorrent.' + system + '. Exception: ' + str(e)
|
print 'Error importing python_libtorrent.' + system + '. Exception: ' + str(e)
|
||||||
pass
|
pass
|
||||||
#from ctypes import *
|
#from ctypes import *
|
||||||
#cdll.LoadLibrary(dirname + '/libtorrent-rasterbar.so.7')
|
#cdll.LoadLibrary(dirname + '/libtorrent-rasterbar.so.7')'''
|
||||||
|
|
||||||
|
self.platform=get_platform()
|
||||||
|
|
||||||
|
print '[Libtorrent] self.platform: '+str(self.platform)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import libtorrent
|
||||||
|
print 'Imported libtorrent v' + libtorrent.version + ' from system'
|
||||||
|
except Exception, e:
|
||||||
|
print 'Error importing from system. Exception: ' + str(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
dirname = os.path.join(xbmc.translatePath('special://home'), 'addons', 'script.module.libtorrent',
|
||||||
|
'python_libtorrent', self.platform['system'])
|
||||||
|
sys.path.insert(0, dirname)
|
||||||
|
import libtorrent
|
||||||
|
print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' + self.platform['system']
|
||||||
|
except Exception, e:
|
||||||
|
print 'Error importing python_libtorrent.' + self.platform['system'] + '. Exception: ' + str(e)
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.lt = libtorrent
|
||||||
|
del libtorrent
|
||||||
|
except:
|
||||||
|
xbmcgui.Dialog().ok(Localization.localize('Python-Libtorrent Not Found'),
|
||||||
|
Localization.localize(self.platform["message"][0]),Localization.localize(self.platform["message"][1]))
|
||||||
|
return
|
||||||
|
|
||||||
self.lt = libtorrent
|
|
||||||
del libtorrent
|
|
||||||
self.storageDirectory = storageDirectory
|
self.storageDirectory = storageDirectory
|
||||||
self.torrentFilesPath=os.path.join(self.storageDirectory, torrentFilesDirectory)+os.sep
|
self.torrentFilesPath=os.path.join(self.storageDirectory, torrentFilesDirectory)+os.sep
|
||||||
if xbmcvfs.exists(torrentFile):
|
if xbmcvfs.exists(torrentFile):
|
||||||
|
@ -245,11 +270,17 @@ class Libtorrent:
|
||||||
|
|
||||||
def getContentList(self):
|
def getContentList(self):
|
||||||
filelist = []
|
filelist = []
|
||||||
for contentId, contentFile in enumerate(self.torrentFileInfo.files()):
|
try:
|
||||||
stringdata = {"title": contentFile.path, "size": contentFile.size, "ind": int(contentId),
|
for contentId, contentFile in enumerate(self.torrentFileInfo.files()):
|
||||||
'offset': contentFile.offset}
|
stringdata = {"title": contentFile.path, "size": contentFile.size, "ind": int(contentId),
|
||||||
filelist.append(stringdata)
|
'offset': contentFile.offset}
|
||||||
return filelist
|
filelist.append(stringdata)
|
||||||
|
return filelist
|
||||||
|
except:
|
||||||
|
xbmcgui.Dialog().ok(Localization.localize('Python-Libtorrent Not Found'),
|
||||||
|
Localization.localize(self.platform["message"][0]),Localization.localize(self.platform["message"][1]))
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def getSubsIds(self, filename):
|
def getSubsIds(self, filename):
|
||||||
subs=[]
|
subs=[]
|
||||||
|
|
|
@ -232,8 +232,20 @@ dictionary = {
|
||||||
'Rating:':'Рейтинг:',
|
'Rating:':'Рейтинг:',
|
||||||
'Information not found!':'Информация не найдена!',
|
'Information not found!':'Информация не найдена!',
|
||||||
'Choose searcher':'Выберите трекер',
|
'Choose searcher':'Выберите трекер',
|
||||||
|
'Python-Libtorrent Not Found':'Python-Libtorrent не найден',
|
||||||
|
'Windows has static compiled python-libtorrent included.':'На Windows при установке из репозитория к плагину идет python-libtorrent.',
|
||||||
|
'You should install "script.module.libtorrent" from "MyShows.me Kodi Repo"':'Установите "script.module.libtorrent" из "MyShows.me Kodi Repo"',
|
||||||
|
'Linux x64 has not static compiled python-libtorrent included.':'На Linux x64 не смогли собрать статическую python-libtorrent',
|
||||||
|
'You should install it by "sudo apt-get install python-libtorrent"':'Установи коммандой "sudo apt-get install python-libtorrent"',
|
||||||
|
'Linux has static compiled python-libtorrent included but it didn\'t work.':'На Linux x86 есть статическая python-libtorrent, но она очевидно не сработала.',
|
||||||
|
'As far as I know you can compile python-libtorrent for ARMv6-7.':'На ARMv6-7 можно скомпилировать python-libtorrent',
|
||||||
|
'You should search for "OneEvil\'s OpenELEC libtorrent" or use Ace Stream.':'Поищи "OneEvil\'s OpenELEC libtorrent" или используй Ace Stream',
|
||||||
|
'Please use install Ace Stream APK and choose it in Settings.':'Установите Ace Stream APK и выберите плеер в Найстройка плагина',
|
||||||
|
'It is possible to compile python-libtorrent for Android, but I don\'t know how.':'Вообще скомпилировать python-libtorrent на Android можно, но мы не знаем как.',
|
||||||
|
'It is possible to compile python-libtorrent for OS X.':'Вообще скомпилировать python-libtorrent на OS X можно.',
|
||||||
|
'But you would have to do it by yourself, there is some info on github.com.':'Но придется это тебе делать самому, на гитхабе была инфа',
|
||||||
|
'It is NOT possible to compile python-libtorrent for iOS.':'Под iOS невозможно скомпилировать python-libtorrent',
|
||||||
|
'But you can use torrent-client control functions.':'Но все остальные функции кроме прямого стриминга с торрента работают.',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.torrenter" name="Torrenter" version="2.2.7" provider-name="vadim.skorba, DiMartino">
|
<addon id="plugin.video.torrenter" name="Torrenter" version="2.2.8" provider-name="vadim.skorba, DiMartino">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.libtorrent"/>
|
<import addon="script.module.libtorrent"/>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
[B]Version 2.2.5[/B]
|
[B]Version 2.2.7[/B]
|
||||||
|
[+] Проигрыватель: User-friendly объяснение причины невозможности стриминга
|
||||||
|
[+] Торрент-клиент: Исправлено добавление magnet
|
||||||
|
|
||||||
|
[B]Version 2.2.5[/B]
|
||||||
[+] Списки Медиа: Исправлен KickAssSo
|
[+] Списки Медиа: Исправлен KickAssSo
|
||||||
[+] Списки Медиа: Исправлен поиск мета-данных TheMovieDB вызывавший ошибку
|
[+] Списки Медиа: Исправлен поиск мета-данных TheMovieDB вызывавший ошибку
|
||||||
[+] Поиск: Исправлен KickAssSo
|
[+] Поиск: Исправлен KickAssSo
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
import xbmc
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def get_platform():
|
||||||
|
ret = {
|
||||||
|
"arch": sys.maxsize > 2**32 and "x64" or "x86",
|
||||||
|
}
|
||||||
|
if xbmc.getCondVisibility("system.platform.android"):
|
||||||
|
ret["os"] = "android"
|
||||||
|
if "arm" in os.uname()[4]:
|
||||||
|
ret["arch"] = "arm"
|
||||||
|
elif xbmc.getCondVisibility("system.platform.linux"):
|
||||||
|
ret["os"] = "linux"
|
||||||
|
if "arm" in os.uname()[4]:
|
||||||
|
ret["arch"] = "arm"
|
||||||
|
elif xbmc.getCondVisibility("system.platform.xbox"):
|
||||||
|
system_platform = "xbox"
|
||||||
|
ret["arch"] = ""
|
||||||
|
elif xbmc.getCondVisibility("system.platform.windows"):
|
||||||
|
ret["os"] = "windows"
|
||||||
|
elif xbmc.getCondVisibility("system.platform.osx"):
|
||||||
|
ret["os"] = "darwin"
|
||||||
|
elif xbmc.getCondVisibility("system.platform.ios"):
|
||||||
|
ret["os"] = "ios"
|
||||||
|
ret["arch"] = "arm"
|
||||||
|
|
||||||
|
ret["system"] = ''
|
||||||
|
ret["message"]=['','']
|
||||||
|
|
||||||
|
if ret["os"]=='windows':
|
||||||
|
ret["system"] = 'windows'
|
||||||
|
ret["message"]=['Windows has static compiled python-libtorrent included.',
|
||||||
|
'You should install "script.module.libtorrent" from "MyShows.me Kodi Repo"']
|
||||||
|
elif ret["os"] == "linux" and ret["arch"] == "x64":
|
||||||
|
ret["system"] = 'linux_x86_64'
|
||||||
|
ret["message"]=['Linux x64 has not static compiled python-libtorrent included.',
|
||||||
|
'You should install it by "sudo apt-get install python-libtorrent"']
|
||||||
|
elif ret["os"] == "linux" and ret["arch"] == "x86":
|
||||||
|
ret["system"] = 'linux_x86'
|
||||||
|
ret["message"]=['Linux has static compiled python-libtorrent included but it didn\'t work.',
|
||||||
|
'You should install it by "sudo apt-get install python-libtorrent"']
|
||||||
|
elif ret["os"] == "linux" and ret["arch"] == "arm":
|
||||||
|
ret["system"] = 'linux_arm'
|
||||||
|
ret["message"]=['As far as I know you can compile python-libtorrent for ARMv6-7.',
|
||||||
|
'You should search for "OneEvil\'s OpenELEC libtorrent" or use Ace Stream.']
|
||||||
|
elif ret["os"] == "android":
|
||||||
|
ret["system"] = 'android'
|
||||||
|
ret["message"]=['Please use install Ace Stream APK and choose it in Settings.',
|
||||||
|
'It is possible to compile python-libtorrent for Android, but I don\'t know how.']
|
||||||
|
elif ret["os"] == "darwin":
|
||||||
|
ret["system"] = 'darwin'
|
||||||
|
ret["message"]=['It is possible to compile python-libtorrent for OS X.',
|
||||||
|
'But you would have to do it by yourself, there is some info on github.com.']
|
||||||
|
elif ret["os"] == "ios":
|
||||||
|
ret["system"] = 'ios'
|
||||||
|
ret["message"]=['It is NOT possible to compile python-libtorrent for iOS.',
|
||||||
|
'But you can use torrent-client control functions.']
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
PLATFORM = get_platform()
|
Loading…
Reference in New Issue