Merge pull request #34 from srg70/master

Fix resume-data code to be able to use multi-file torrents.
pull/1/head
DiMartinoXBMC 2016-03-07 18:42:19 +03:00
commit e347017cac
2 changed files with 5 additions and 3 deletions

View File

@ -491,6 +491,7 @@ class Libtorrent:
self.session.stop_dht()
def resume_data(self):
wasPaused=self.session.is_paused()
self.session.pause()
self.save_resume_data=None
@ -504,7 +505,7 @@ class Libtorrent:
return
log('[save_resume_data]: waiting for alert...')
self.torrentHandle.save_resume_data()
self.torrentHandle.save_resume_data(self.lt.save_resume_flags_t.flush_disk_cache)
received=False
while not received:
self.session.wait_for_alert(1000)
@ -528,7 +529,8 @@ class Libtorrent:
log('[save_resume_data]: done.')
finally:
self.session.resume()
if not wasPaused:
self.session.resume()
def debug(self):
#try:

View File

@ -289,7 +289,7 @@ class TorrentPlayer(xbmc.Player):
#self.torrent.torrentHandle.flush_cache()
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
self.torrent.resume_data()
self.torrent.session.remove_torrent(self.torrent.torrentHandle)
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
progressBar.update(0)
progressBar.close()
return True