Merge pull request #8 from DiMartinoXBMC/master

merge from origin
pull/11/head
inpos 2016-03-21 22:15:35 +04:00
commit 2f19505a6d
8 changed files with 529 additions and 601 deletions

File diff suppressed because it is too large Load Diff

View File

@ -121,8 +121,8 @@ class AceStream:
def magnetToTorrent(self, magnet): def magnetToTorrent(self, magnet):
try: try:
from Libtorrent import Libtorrent from SkorbaLoader import SkorbaLoader
torrent = Libtorrent(self.storageDirectory, magnet) torrent = SkorbaLoader(self.storageDirectory, magnet)
torrent.magnetToTorrent(magnet) torrent.magnetToTorrent(magnet)
self.torrentFile = torrent.torrentFile self.torrentFile = torrent.torrentFile
log('[AceStream][magnetToTorrent]: self.torrentFile '+str(self.torrentFile)) log('[AceStream][magnetToTorrent]: self.torrentFile '+str(self.torrentFile))

View File

@ -153,8 +153,8 @@ class AnteoLoader:
def getContentList(self): def getContentList(self):
try: try:
from Libtorrent import Libtorrent from SkorbaLoader import SkorbaLoader
torrent = Libtorrent(self.storageDirectory, self.torrentFile) torrent = SkorbaLoader(self.storageDirectory, self.torrentFile)
return torrent.getContentList() return torrent.getContentList()
except: except:
import traceback import traceback
@ -249,8 +249,8 @@ class AnteoLoader:
def magnetToTorrent(self, magnet): def magnetToTorrent(self, magnet):
try: try:
from Libtorrent import Libtorrent from SkorbaLoader import SkorbaLoader
torrent = Libtorrent(self.storageDirectory, magnet) torrent = SkorbaLoader(self.storageDirectory, magnet)
torrent.magnetToTorrent(magnet) torrent.magnetToTorrent(magnet)
self.torrentFile = torrent.torrentFile self.torrentFile = torrent.torrentFile
except: except:
@ -612,7 +612,7 @@ class AnteoPlayer(xbmc.Player):
def _get_status_lines(self, s, f): def _get_status_lines(self, s, f):
return [ return [
localize_path(self.display_name), ensure_str(self.display_name),
"%.2f%% %s" % (f.progress * 100, self.localize(STATE_STRS[s.state]).decode('utf-8')), "%.2f%% %s" % (f.progress * 100, self.localize(STATE_STRS[s.state]).decode('utf-8')),
"D:%.2f%s U:%.2f%s S:%d P:%d" % (s.download_rate, self.localize('kb/s').decode('utf-8'), "D:%.2f%s U:%.2f%s S:%d P:%d" % (s.download_rate, self.localize('kb/s').decode('utf-8'),
s.upload_rate, self.localize('kb/s').decode('utf-8'), s.upload_rate, self.localize('kb/s').decode('utf-8'),

View File

@ -1401,6 +1401,9 @@ class Core:
self.Player = InposPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params) self.Player = InposPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
else: else:
log(self.__plugin__ + " Unexpected access to method playTorrent() without torrent content") log(self.__plugin__ + " Unexpected access to method playTorrent() without torrent content")
elif self.torrent_player == '4':
xbmc.executebuiltin('XBMC.ActivateWindow(%s)' % 'Videos,plugin://plugin.video.yatp/?action=play&torrent=%s&file_index=%s' % (urllib.quote_plus(torrentUrl), params['url']))
#xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.yatp/?action=play&torrent=%s&file_index=%s")' % (urllib.quote_plus(torrentUrl), params['url']))
elif self.torrent_player == '1': elif self.torrent_player == '1':
__ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts') __ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts')
folder=__ASsettings__.getSetting("folder") folder=__ASsettings__.getSetting("folder")
@ -1740,7 +1743,7 @@ class Core:
Download().setprio(id, ind) Download().setprio(id, ind)
def downloadLibtorrent(self, params={}): def downloadLibtorrent(self, params={}):
import Libtorrent import SkorbaLoader
get = params.get get = params.get
storage=get('storage') storage=get('storage')
if not storage: self.userStorage(params) if not storage: self.userStorage(params)
@ -1756,7 +1759,7 @@ class Core:
if classMatch: if classMatch:
searcher = classMatch.group(1) searcher = classMatch.group(1)
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher) url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
torrent = Libtorrent.Libtorrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) torrent = SkorbaLoader.SkorbaLoader(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
torrent.initSession() torrent.initSession()
encryption = self.__settings__.getSetting('encryption') == 'true' encryption = self.__settings__.getSetting('encryption') == 'true'
if encryption: if encryption:

View File

@ -29,8 +29,8 @@ class Torrent():
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
self.get_torrent_client() self.get_torrent_client()
if self.player == 'libtorrent': if self.player == 'libtorrent':
import Libtorrent import SkorbaLoader
self.player = Libtorrent.Libtorrent(storageDirectory, torrentFile, torrentFilesDirectory) self.player = SkorbaLoader.SkorbaLoader(storageDirectory, torrentFile, torrentFilesDirectory)
elif self.player == 'acestream': elif self.player == 'acestream':
import AceStream import AceStream
@ -49,7 +49,7 @@ class Torrent():
def get_torrent_client(self): def get_torrent_client(self):
player = self.__settings__.getSetting("torrent_player") player = self.__settings__.getSetting("torrent_player")
if player == '0': if player == '0' or '4':
self.player = 'libtorrent' self.player = 'libtorrent'
elif player == '1': elif player == '1':
self.player = 'acestream' self.player = 'acestream'

View File

@ -152,8 +152,8 @@ class InposLoader:
return string return string
def getContentList(self): def getContentList(self):
from Libtorrent import Libtorrent from SkorbaLoader import SkorbaLoader
torrent = Libtorrent(self.storageDirectory, self.torrentFile) torrent = SkorbaLoader(self.storageDirectory, self.torrentFile)
return torrent.getContentList() return torrent.getContentList()
def saveTorrent(self, torrentUrl): def saveTorrent(self, torrentUrl):
@ -206,8 +206,8 @@ class InposLoader:
def magnetToTorrent(self, magnet): def magnetToTorrent(self, magnet):
try: try:
from Libtorrent import Libtorrent from SkorbaLoader import SkorbaLoader
torrent = Libtorrent(self.storageDirectory, magnet) torrent = SkorbaLoader(self.storageDirectory, magnet)
torrent.magnetToTorrent(magnet) torrent.magnetToTorrent(magnet)
self.torrentFile = torrent.torrentFile self.torrentFile = torrent.torrentFile
except: except:

View File

@ -34,7 +34,7 @@ import Localization
from functions import isSubtitle, DownloadDB, log, debug, is_writable,\ from functions import isSubtitle, DownloadDB, log, debug, is_writable,\
vista_check, windows_check, localize_path vista_check, windows_check, localize_path
class Libtorrent: class SkorbaLoader:
magnetLink = None magnetLink = None
startPart = 0 startPart = 0
endPart = 0 endPart = 0

View File

@ -2064,11 +2064,11 @@ def localize_path(path):
def encode_msg(msg): def encode_msg(msg):
try: try:
msg = isinstance(msg, unicode) and msg.encode(True and sys.getfilesystemencoding() or 'utf-8') or msg msg = isinstance(msg, unicode) and msg.encode('utf-8') or msg
except: except:
import traceback import traceback
log(traceback.format_exc()) log(traceback.format_exc())
msg = msg.encode('utf-8') msg = ensure_str(msg)
return msg return msg
def get_platform(): def get_platform():