diff --git a/addon.py b/addon.py index 978a25d..31d9a87 100644 --- a/addon.py +++ b/addon.py @@ -7,7 +7,7 @@ import xbmcgui, xbmc from resources.lib.searchers import rutor from resources.lib.utils import localize, store_torrent_file, get_engine from resources.lib.overrrides.session import torrent_file_fetch -from resources.lib.player import PlaybackWindow, VideoLoop +from resources.lib.player import VideoLoop video_extensions = ('.mp4', '.avi', '.3gp', '.ogv', '.mkv', '.ts', '.mpg', '.mpeg', '.webm', '.flv', '.vob') diff --git a/addon.xml b/addon.xml index 2bbfaa3..b672c6e 100644 --- a/addon.xml +++ b/addon.xml @@ -7,11 +7,13 @@ - audio video + video Plugin helps you to watch videos from p2p torrent-networks, without full predownload. - Plugin helps you to watch videos from p2p torrent-networks, without full predownload. + This add-on is fully rewrited version of Torrenter v2 + Позволяет смотреть видео из p2p-сети torrent без предварителной закачки. + Этот модуль является полностью переписанной версией модуля Torrenter v2 MIT https://git.ukamnya.ru/ukamnya/plugin.video.torrenter3 http://xbmc.ru/forum/showthread.php?t=14787 @@ -26,7 +28,7 @@ resources/screenshots/screenshot001.jpg resources/screenshots/screenshot002.jpg --> - Initial release + - 3.0.1: first rewrited version true \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..2bf55b4 Binary files /dev/null and b/icon.png differ diff --git a/resources/lib/player.py b/resources/lib/player.py index a7e8a11..ce4e0da 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -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) diff --git a/resources/lib/searchers/rutor.py b/resources/lib/searchers/rutor.py index def1e07..740ff89 100644 --- a/resources/lib/searchers/rutor.py +++ b/resources/lib/searchers/rutor.py @@ -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' diff --git a/resources/lib/utils/__init__.py b/resources/lib/utils/__init__.py index c29f363..a9c9fd1 100644 --- a/resources/lib/utils/__init__.py +++ b/resources/lib/utils/__init__.py @@ -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))