Версия 3.0.1

master
Бородин Роман 2019-05-05 10:16:32 +03:00
parent 6ec2e7eea0
commit 47946616e7
6 changed files with 22 additions and 14 deletions

View File

@ -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')

View File

@ -7,11 +7,13 @@
<import addon="script.module.pysocks" version="1.0.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>audio video</provides>
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Plugin helps you to watch videos from p2p torrent-networks, without full predownload.</summary>
<description lang="en_GB">Plugin helps you to watch videos from p2p torrent-networks, without full predownload.</description>
<description lang="en_GB">This add-on is fully rewrited version of Torrenter v2</description>
<summary lang="ru_RU">Позволяет смотреть видео из p2p-сети torrent без предварителной закачки.</summary>
<description lang="ru_RU">Этот модуль является полностью переписанной версией модуля Torrenter v2 </description>
<license>MIT</license>
<source>https://git.ukamnya.ru/ukamnya/plugin.video.torrenter3</source>
<forum>http://xbmc.ru/forum/showthread.php?t=14787</forum>
@ -26,7 +28,7 @@
<screenshot>resources/screenshots/screenshot001.jpg</screenshot>
<screenshot>resources/screenshots/screenshot002.jpg</screenshot> -->
</assets>
<news>Initial release</news>
<news>- 3.0.1: first rewrited version</news>
<reuselanguageinvoker>true</reuselanguageinvoker>
</extension>
</addon>

BIN
icon.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -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)

View File

@ -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'

View File

@ -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))