diff --git a/Player.py b/Player.py index 1b06409..902bd05 100644 --- a/Player.py +++ b/Player.py @@ -177,11 +177,13 @@ class TorrentPlayer(xbmc.Player): def setup_torrent(self): self.torrent.startSession() - if 0 < int(self.__settings__.getSetting("upload_limit")): - self.torrent.setUploadLimit(int(self.__settings__.getSetting("upload_limit")) * 1000000 / 8) #MBits/second - if 0 < int(self.__settings__.getSetting("download_limit")): + upload_limit=self.__settings__.getSetting("upload_limit") if self.__settings__.getSetting("upload_limit")!="" else 0 + if 0 < int(upload_limit): + self.torrent.setUploadLimit(int(upload_limit) * 1000000 / 8) #MBits/second + download_limit=self.__settings__.getSetting("download_limit") if self.__settings__.getSetting("download_limit")!="" else 0 + if 0 < int(download_limit): self.torrent.setDownloadLimit( - int(self.__settings__.getSetting("download_limit")) * 1000000 / 8) #MBits/second + int(download_limit) * 1000000 / 8) #MBits/second self.torrent.status = False self.fullSize = self.torrent.getFileSize(self.contentId) Offset = calculate(self.fullSize) diff --git a/addon.xml b/addon.xml index e6331b9..9e807f6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/functions.py b/functions.py index 3315c72..5f45b93 100644 --- a/functions.py +++ b/functions.py @@ -50,10 +50,14 @@ def clearStorage(userStorageDirectory): import shutil temp = userStorageDirectory.rstrip('Torrenter').rstrip('/\\') - shutil.move(os.path.join(userStorageDirectory, 'torrents'), os.path.join(temp, 'torrents')) + torrents_temp,i=None,0 + while not torrents_temp or xbmcvfs.exists(torrents_temp): + torrents_temp=os.path.join(temp, 'torrents'+str(i))+os.sep + i+=1 + shutil.move(os.path.join(userStorageDirectory, 'torrents'), torrents_temp) shutil.rmtree(userStorageDirectory, ignore_errors=True) xbmcvfs.mkdir(userStorageDirectory) - shutil.move(os.path.join(temp, 'torrents'), os.path.join(userStorageDirectory, 'torrents')) + shutil.move(torrents_temp, os.path.join(userStorageDirectory, 'torrents')) DownloadDB().clear() showMessage(Localization.localize('Storage'), Localization.localize('Storage was cleared'), forced=True)