pull/1/head
DiMartinoXBMC 2015-08-02 15:26:16 +03:00
parent 02df953ca1
commit b6a56501ec
2 changed files with 15 additions and 11 deletions

View File

@ -328,13 +328,13 @@ class Libtorrent:
self.session = self.lt.session()
self.session.set_alert_mask(self.lt.alert.category_t.error_notification | self.lt.alert.category_t.status_notification | self.lt.alert.category_t.storage_notification)
#self.session.set_alert_mask(self.lt.alert.category_t.all_categories)
self.session.start_dht()
self.session.add_dht_router("router.bittorrent.com", 6881)
self.session.add_dht_router("router.utorrent.com", 6881)
self.session.add_dht_router("router.bitcomet.com", 6881)
#self.session.start_lsd()
#self.session.start_upnp()
#self.session.start_natpmp()
self.session.start_dht()
self.session.start_lsd()
self.session.start_upnp()
self.session.start_natpmp()
self.session.listen_on(6881, 6891)
#tribler example never tested
@ -357,7 +357,7 @@ class Libtorrent:
session_settings['rate_limit_ip_overhead'] = True
session_settings['request_timeout'] = 1
session_settings['torrent_connect_boost'] = 100
session_settings['user_agent'] = 'uTorrent/3430(40298)'
session_settings['user_agent'] = 'uTorrent/2200(24683)'
#session_settings['cache_size'] = 0
#session_settings['use_read_cache'] = False
@ -373,7 +373,7 @@ class Libtorrent:
session_settings.rate_limit_ip_overhead = True
session_settings.request_timeout = 1
session_settings.torrent_connect_boost = 100
session_settings.user_agent = 'uTorrent/3430(40298)'
session_settings.user_agent = 'uTorrent/2200(24683)'
#
self.session.set_settings(session_settings)
@ -456,9 +456,9 @@ class Libtorrent:
self.session.remove_torrent(self.torrentHandle)
except:
log('RuntimeError: invalid torrent handle used')
#self.session.stop_natpmp()
#self.session.stop_upnp()
#self.session.stop_lsd()
self.session.stop_natpmp()
self.session.stop_upnp()
self.session.stop_lsd()
self.session.stop_dht()
def resume_data(self):

View File

@ -235,8 +235,9 @@ class TorrentPlayer(xbmc.Player):
for ind, title in subs:
self.torrent.continueSession(ind)
num_pieces = int(self.torrent.torrentFileInfo.num_pieces())
while iterator < 100:
xbmc.sleep(1000)
self.torrent.torrentHandle.force_dht_announce()
while iterator < 100:
self.torrent.debug()
downloadedSize = self.torrent.torrentHandle.file_progress()[self.contentId]
status = self.torrent.torrentHandle.status()
@ -267,6 +268,7 @@ class TorrentPlayer(xbmc.Player):
self.torrent.threadComplete = True
self.torrent.checkThread()
return
xbmc.sleep(1000)
#self.torrent.torrentHandle.flush_cache()
self.torrent.resume_data()
self.torrent.session.remove_torrent(self.torrent.torrentHandle)
@ -352,7 +354,7 @@ class TorrentPlayer(xbmc.Player):
playlist.add(path, listitem)
xbmc.Player().play(playlist)
xbmc.sleep(3000) # very important, do not edit this, podavan
xbmc.sleep(2000) # very important, do not edit this, podavan
return True
def onPlayBackStarted(self):
@ -385,6 +387,8 @@ class TorrentPlayer(xbmc.Player):
def loop(self):
debug_counter=0
xbmc.sleep(1000)
self.torrent.torrentHandle.force_dht_announce()
with closing(
OverlayText(w=OVERLAY_WIDTH, h=OVERLAY_HEIGHT, alignment=XBFONT_CENTER_X | XBFONT_CENTER_Y)) as overlay:
with nested(self.attach(overlay.show, self.on_playback_paused),