перезагрузка пустого torrent-файла

master
Бородин Роман 2018-05-26 11:08:29 +03:00
parent 48f56df337
commit 7b7bdd1c6a
1 changed files with 6 additions and 2 deletions

View File

@ -556,9 +556,11 @@ class Core:
if action2 == 'open': if action2 == 'open':
filename, foldername, path, url, seek, length, ind = db.get('filename, foldername, path, url, seek, length, ind', 'addtime', str(addtime)) filename, foldername, path, url, seek, length, ind = db.get('filename, foldername, path, url, seek, length, ind', 'addtime', str(addtime))
if os.path.exists(path): if os.path.exists(path) and os.path.getsize(path) > 0:
self.__settings__.setSetting("lastTorrent", path) self.__settings__.setSetting("lastTorrent", path)
else: else:
if os.path.exists(path):
os.unlink(path)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
path = torrent.saveTorrent(url) path = torrent.saveTorrent(url)
self.__settings__.setSetting("lastTorrent", path) self.__settings__.setSetting("lastTorrent", path)
@ -574,9 +576,11 @@ class Core:
seek = int(seek) seek = int(seek)
else: else:
seek = 0 seek = 0
if os.path.exists(path): if os.path.exists(path) and os.path.getsize(path) > 0:
self.__settings__.setSetting("lastTorrent", path) self.__settings__.setSetting("lastTorrent", path)
else: else:
if os.path.exists(path):
os.unlink(path)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url='+str(ind)+'&seek='+str(seek)+'")') xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=playTorrent&url='+str(ind)+'&seek='+str(seek)+'")')