magnet, platform
parent
cb7f1af5a5
commit
30df420b4f
9
Core.py
9
Core.py
|
@ -1673,6 +1673,10 @@ class Core:
|
|||
self.__settings__.setSetting("lastTorrentUrl", url)
|
||||
classMatch = re.search('(\w+)::(.+)', url)
|
||||
if classMatch:
|
||||
print str(dirname)+str(re.match("^magnet\:.+$", classMatch.group(2))==None)
|
||||
if re.match("^magnet\:.+$", classMatch.group(2)) and dirname:
|
||||
url=classMatch.group(2)
|
||||
else:
|
||||
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')
|
||||
|
@ -1693,11 +1697,14 @@ class Core:
|
|||
torrent.magnetToTorrent(url)
|
||||
url = torrent.torrentFile
|
||||
else:
|
||||
Download().add_url(url, dirname)
|
||||
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()
|
||||
|
|
|
@ -25,7 +25,7 @@ import urllib2
|
|||
import hashlib
|
||||
import re
|
||||
import sys
|
||||
import platform
|
||||
from platform import get_platform
|
||||
from StringIO import StringIO
|
||||
import gzip
|
||||
from functions import file_decode, file_encode, isSubtitle, DownloadDB
|
||||
|
@ -35,7 +35,6 @@ import xbmcgui
|
|||
import xbmcvfs
|
||||
import Localization
|
||||
|
||||
|
||||
class Libtorrent:
|
||||
torrentFile = None
|
||||
magnetLink = None
|
||||
|
@ -73,7 +72,7 @@ class Libtorrent:
|
|||
except Exception, 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:
|
||||
import libtorrent
|
||||
|
@ -101,10 +100,36 @@ class Libtorrent:
|
|||
print 'Error importing python_libtorrent.' + system + '. Exception: ' + str(e)
|
||||
pass
|
||||
#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.storageDirectory = storageDirectory
|
||||
self.torrentFilesPath=os.path.join(self.storageDirectory, torrentFilesDirectory)+os.sep
|
||||
if xbmcvfs.exists(torrentFile):
|
||||
|
@ -245,11 +270,17 @@ class Libtorrent:
|
|||
|
||||
def getContentList(self):
|
||||
filelist = []
|
||||
try:
|
||||
for contentId, contentFile in enumerate(self.torrentFileInfo.files()):
|
||||
stringdata = {"title": contentFile.path, "size": contentFile.size, "ind": int(contentId),
|
||||
'offset': contentFile.offset}
|
||||
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):
|
||||
subs=[]
|
||||
|
|
|
@ -232,8 +232,20 @@ dictionary = {
|
|||
'Rating:':'Рейтинг:',
|
||||
'Information not found!':'Информация не найдена!',
|
||||
'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"?>
|
||||
<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>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<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
|
||||
[+] Списки Медиа: Исправлен поиск мета-данных TheMovieDB вызывавший ошибку
|
||||
[+] Поиск: Исправлен 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