mirror of
				https://github.com/KevinMidboe/transatlanticTorrentExpress.git
				synced 2025-10-29 18:00:19 +00:00 
			
		
		
		
	Calculate, log & save estimated & actual transfer speed
This commit is contained in:
		
							
								
								
									
										21
									
								
								utils.py
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								utils.py
									
									
									
									
									
								
							| @@ -15,4 +15,23 @@ def getConfig(): | ||||
|   config.read(path) | ||||
|  | ||||
|   # logger.debug('Sections parsed: {}'.format(config.sections())) | ||||
|   return config | ||||
|   return config | ||||
|  | ||||
| def writeAvgSpeedToDisk(speed): | ||||
|   path = os.path.join(pwd, '.avgspeed.txt') | ||||
|  | ||||
|   with open(path, 'w') as f: | ||||
|     f.write(str(int(speed))) | ||||
|     f.close() | ||||
|  | ||||
| def readAvgSpeedFromDisk(): | ||||
|   path = os.path.join(pwd, '.avgspeed.txt') | ||||
|  | ||||
|   with open(path, 'r') as f: | ||||
|     data = f.readline() | ||||
|     f.close() | ||||
|  | ||||
|   if data == '': | ||||
|     data = '1' | ||||
|  | ||||
|   return int(data) | ||||
		Reference in New Issue
	
	Block a user