fixing hardcoded path (wow...)

This commit is contained in:
Ryan Tucker 2011-06-10 20:26:58 -04:00
parent 6360655bf8
commit 45360b0b1a
2 changed files with 15 additions and 13 deletions

View file

@ -11,6 +11,7 @@
# accesskey = 'amazon aws access key'
# sharedkey = 'amazon aws shared key'
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
# speedfile = '/path/to/a/speed-limit-file'
import base64
import glob
@ -141,18 +142,19 @@ class SlowFile:
logger.debug('Target %i bytes/second (%i kilobits/second), delay factor %.2f, block len %i' % (targetspeed, targetspeed*8/1024, self.delayfactor, len))
try:
newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline())
newspeed = int((newkbits/float(8))*1024)
if newspeed != self.speed:
self.delayfactor = 1
self.speed = newspeed
logger.debug('Setting new speed! %i bytes/second' % newspeed)
self.lastblocktargettime = 0
except IOError:
logger.debug('No Semaphore file for new speed')
except ValueError:
logger.debug('Semaphore file invalid')
if hasattr(secrets, 'speedfile'):
try:
newkbits = int(open(secrets.speedfile, 'r').readline())
newspeed = int((newkbits/float(8))*1024)
if newspeed != self.speed:
self.delayfactor = 1
self.speed = newspeed
logger.debug('Setting new speed! %i bytes/second' % newspeed)
self.lastblocktargettime = 0
except IOError:
logger.debug('IO Error opening semaphore file')
except ValueError:
logger.debug('Semaphore file invalid')
self.lastdebug = time.time()

View file

@ -2,4 +2,4 @@
# accesskey = 'amazon aws access key'
# sharedkey = 'amazon aws shared key'
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
# speedfile = 'path to a file that has a max upload speed in kbits/sec'