Версия 3.0.1
This commit is contained in:
1 parent
6ec2e7eea0
commit
47946616e7
6 files changed
+22
-14
No files matched your search
+13
-8
@@ -1,8 +1,6 @@
|
||||
import xbmc, xbmcgui
|
||||
from .utils import get_engine, localize
|
||||
|
||||
EXPECTED_KBITS = 512
|
||||
|
||||
class TorrentPlayer(xbmc.Player) :
|
||||
pyrrent_engine = None
|
||||
loop = None
|
||||
@@ -12,9 +10,11 @@ class TorrentPlayer(xbmc.Player) :
|
||||
xbmc.Player().stop()
|
||||
def onPlayBackPaused(self):
|
||||
self.pyrrent_engine.pause()
|
||||
#self.loop.overlay.show()
|
||||
|
||||
def onPlayBackResumed(self):
|
||||
self.pyrrent_engine.resume()
|
||||
self.loop.overlay.hide()
|
||||
#self.pyrrent_engine.resume()
|
||||
|
||||
def onPlayBackStopped(self):
|
||||
self.pyrrent_engine.close()
|
||||
@@ -27,6 +27,8 @@ class TorrentPlayer(xbmc.Player) :
|
||||
monitor = xbmc.Monitor()
|
||||
pw = xbmcgui.DialogProgress()
|
||||
pw.create(localize(33055), line1='0 Kbit/s')
|
||||
f_size = self.pyrrent_engine.file_status(f_index).size
|
||||
EXPECTED_KBYTES = f_size / 3 / 1024 / 1024
|
||||
while True:
|
||||
xbmc.sleep(500)
|
||||
if monitor.abortRequested() or pw.iscanceled():
|
||||
@@ -37,10 +39,10 @@ class TorrentPlayer(xbmc.Player) :
|
||||
return False
|
||||
status = self.pyrrent_engine.status()
|
||||
d_rate = status.download_rate
|
||||
xbmc.log('*** DRATE: {}'.format(d_rate), level=xbmc.LOGNOTICE)
|
||||
perc = d_rate / EXPECTED_KBITS * 100
|
||||
# xbmc.log('*** DRATE: {}'.format(d_rate), level=xbmc.LOGNOTICE)
|
||||
perc = d_rate / EXPECTED_KBYTES * 100
|
||||
if perc > 100: perc = 100
|
||||
pw.update(perc, line1='{} kbit/s'.format(int(d_rate)))
|
||||
pw.update(perc, line1=' {} / {} KB/s'.format(int(d_rate), int(EXPECTED_KBYTES)))
|
||||
if perc == 100:
|
||||
pw.close()
|
||||
break
|
||||
@@ -50,7 +52,6 @@ class TorrentPlayer(xbmc.Player) :
|
||||
|
||||
class VideoLoop(object):
|
||||
stopped = False
|
||||
status = None
|
||||
def __init__(self, torr_fp):
|
||||
self.e = get_engine(torr_fp)
|
||||
def start(self, f_index):
|
||||
@@ -58,5 +59,9 @@ class VideoLoop(object):
|
||||
self.mediaPlayer.loop = self
|
||||
self.mediaPlayer.play(self.e, f_index)
|
||||
while not self.stopped:
|
||||
self.status = self.e.status()
|
||||
# sometime busydialog is showing in infinite loop. kick it.
|
||||
if xbmc.getCondVisibility('Window.IsVisible(busydialog)'):
|
||||
xbmc.executebuiltin("Dialog.Close(busydialog)")
|
||||
status = self.e.status()
|
||||
f_status = self.e.file_status(f_index)
|
||||
xbmc.sleep(1000)
|
||||
@@ -1,7 +1,8 @@
|
||||
from . import Searcher, urljoin_partial, ResultItem
|
||||
|
||||
class SearchEngine(Searcher):
|
||||
base_url = 'http://new-tor.top'
|
||||
#base_url = 'http://new-tor.top'
|
||||
base_url = 'http://rutor.info'
|
||||
search_path = '/search/0/0/100/2/{}'
|
||||
name = 'RuTor.org'
|
||||
icon = 'searcher_rutor.png'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from codequick.support import addon_data # @UnresolvedImport
|
||||
from codequick.listing import local_image # @UnresolvedImport
|
||||
from urlquick import urljoin # @UnresolvedImport
|
||||
from ..settings import option, storage_toorents_dir, storage_download_dir
|
||||
import xbmcgui
|
||||
@@ -38,7 +39,6 @@ def get_engine(torrent_uri):
|
||||
encryption=1, keep_complete=False, keep_incomplete=False,
|
||||
dht_routers=["router.bittorrent.com:6881", "router.utorrent.com:6881"], use_random_port=False, listen_port=6881,
|
||||
user_agent='', enable_dht=True)
|
||||
|
||||
while not option['storage_dir']:
|
||||
dialog = xbmcgui.Dialog()
|
||||
dialog.ok(localize(33000), localize(33051))
|
||||
|
||||
Reference in new issue
Block a user