SkorbaLoader

pull/8/head
DiMartinoXBMC 2016-03-21 19:36:44 +03:00
parent 337de1c95f
commit 106e42279d
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):
try:
from Libtorrent import Libtorrent
torrent = Libtorrent(self.storageDirectory, magnet)
from SkorbaLoader import SkorbaLoader
torrent = SkorbaLoader(self.storageDirectory, magnet)
torrent.magnetToTorrent(magnet)
self.torrentFile = torrent.torrentFile
log('[AceStream][magnetToTorrent]: self.torrentFile '+str(self.torrentFile))

View File

@ -153,8 +153,8 @@ class AnteoLoader:
def getContentList(self):
try:
from Libtorrent import Libtorrent
torrent = Libtorrent(self.storageDirectory, self.torrentFile)
from SkorbaLoader import SkorbaLoader
torrent = SkorbaLoader(self.storageDirectory, self.torrentFile)
return torrent.getContentList()
except:
import traceback
@ -249,8 +249,8 @@ class AnteoLoader:
def magnetToTorrent(self, magnet):
try:
from Libtorrent import Libtorrent
torrent = Libtorrent(self.storageDirectory, magnet)
from SkorbaLoader import SkorbaLoader
torrent = SkorbaLoader(self.storageDirectory, magnet)
torrent.magnetToTorrent(magnet)
self.torrentFile = torrent.torrentFile
except:
@ -612,7 +612,7 @@ class AnteoPlayer(xbmc.Player):
def _get_status_lines(self, s, f):
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')),
"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'),

View File

@ -1401,6 +1401,9 @@ class Core:
self.Player = InposPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
else:
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':
__ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts')
folder=__ASsettings__.getSetting("folder")
@ -1740,7 +1743,7 @@ class Core:
Download().setprio(id, ind)
def downloadLibtorrent(self, params={}):
import Libtorrent
import SkorbaLoader
get = params.get
storage=get('storage')
if not storage: self.userStorage(params)
@ -1756,7 +1759,7 @@ class Core:
if classMatch:
searcher = classMatch.group(1)
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()
encryption = self.__settings__.getSetting('encryption') == 'true'
if encryption:

View File

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

View File

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

View File

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

View File

@ -2064,11 +2064,11 @@ def localize_path(path):
def encode_msg(msg):
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:
import traceback
log(traceback.format_exc())
msg = msg.encode('utf-8')
msg = ensure_str(msg)
return msg
def get_platform():