From 106e42279d881bc9c7ba2f0f2abe569c094bc1e6 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Mon, 21 Mar 2016 19:36:44 +0300 Subject: [PATCH] SkorbaLoader --- .idea/workspace.xml | 1089 ++++++++++++++---------------- AceStream.py | 4 +- Anteoloader.py | 10 +- Core.py | 7 +- Downloader.py | 6 +- Inposloader.py | 8 +- Libtorrent.py => SkorbaLoader.py | 2 +- functions.py | 4 +- 8 files changed, 529 insertions(+), 601 deletions(-) rename Libtorrent.py => SkorbaLoader.py (99%) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b04c831..9119024 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,16 @@ - + + + + + + + + @@ -37,7 +44,7 @@ - + @@ -62,120 +69,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -184,51 +95,117 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + @@ -242,7 +219,7 @@ - + @@ -253,15 +230,17 @@ - + + - + + @@ -274,47 +253,46 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -358,26 +336,28 @@ - + - + - - - + + + + + - + - + @@ -406,12 +386,9 @@ @@ -491,7 +471,6 @@ - @@ -607,6 +586,7 @@ + @@ -788,48 +768,6 @@ + + + + + + + + + - + - - - + + + - + + - + - - + @@ -1123,11 +1112,6 @@ - - - - - @@ -1148,7 +1132,12 @@ - @@ -1157,20 +1146,6 @@ - - - - - - - - - - - - - - @@ -1241,14 +1216,6 @@ - - - - - - - - @@ -1277,13 +1244,6 @@ - - - - - - - @@ -1298,62 +1258,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1361,13 +1265,6 @@ - - - - - - - @@ -1375,36 +1272,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1517,152 +1384,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1702,14 +1423,6 @@ - - - - - - - - @@ -1726,59 +1439,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AceStream.py b/AceStream.py index 699d7e9..8d7137f 100644 --- a/AceStream.py +++ b/AceStream.py @@ -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)) diff --git a/Anteoloader.py b/Anteoloader.py index 0af4112..b2a67cc 100644 --- a/Anteoloader.py +++ b/Anteoloader.py @@ -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'), diff --git a/Core.py b/Core.py index a9c1abf..5028d59 100644 --- a/Core.py +++ b/Core.py @@ -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: diff --git a/Downloader.py b/Downloader.py index 468972a..5a1c251 100644 --- a/Downloader.py +++ b/Downloader.py @@ -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' diff --git a/Inposloader.py b/Inposloader.py index 2db5ece..9d95f46 100644 --- a/Inposloader.py +++ b/Inposloader.py @@ -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: diff --git a/Libtorrent.py b/SkorbaLoader.py similarity index 99% rename from Libtorrent.py rename to SkorbaLoader.py index e95c99e..020a550 100644 --- a/Libtorrent.py +++ b/SkorbaLoader.py @@ -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 diff --git a/functions.py b/functions.py index 46537a8..e7e8fa1 100644 --- a/functions.py +++ b/functions.py @@ -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():