Merge pull request #34 from srg70/master
Fix resume-data code to be able to use multi-file torrents.pull/1/head
commit
e347017cac
|
@ -491,6 +491,7 @@ class Libtorrent:
|
||||||
self.session.stop_dht()
|
self.session.stop_dht()
|
||||||
|
|
||||||
def resume_data(self):
|
def resume_data(self):
|
||||||
|
wasPaused=self.session.is_paused()
|
||||||
self.session.pause()
|
self.session.pause()
|
||||||
self.save_resume_data=None
|
self.save_resume_data=None
|
||||||
|
|
||||||
|
@ -504,7 +505,7 @@ class Libtorrent:
|
||||||
return
|
return
|
||||||
|
|
||||||
log('[save_resume_data]: waiting for alert...')
|
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
|
received=False
|
||||||
while not received:
|
while not received:
|
||||||
self.session.wait_for_alert(1000)
|
self.session.wait_for_alert(1000)
|
||||||
|
@ -528,7 +529,8 @@ class Libtorrent:
|
||||||
log('[save_resume_data]: done.')
|
log('[save_resume_data]: done.')
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.session.resume()
|
if not wasPaused:
|
||||||
|
self.session.resume()
|
||||||
|
|
||||||
def debug(self):
|
def debug(self):
|
||||||
#try:
|
#try:
|
||||||
|
|
|
@ -289,7 +289,7 @@ class TorrentPlayer(xbmc.Player):
|
||||||
#self.torrent.torrentHandle.flush_cache()
|
#self.torrent.torrentHandle.flush_cache()
|
||||||
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
||||||
self.torrent.resume_data()
|
self.torrent.resume_data()
|
||||||
self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
#self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
||||||
progressBar.update(0)
|
progressBar.update(0)
|
||||||
progressBar.close()
|
progressBar.close()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue