Proper variable naming

This commit is contained in:
Ruud
2013-09-29 10:06:12 +02:00
parent 8f76dd7a2e
commit 99c899ea3a
+10 -9
View File
@@ -33,26 +33,27 @@ class Blackhole(Downloader):
log.error('No nzb/torrent available: %s', data.get('url')) log.error('No nzb/torrent available: %s', data.get('url'))
return False return False
fullPath = os.path.join(directory, self.createFileName(data, filedata, movie)) file_name = self.createFileName(data, filedata, movie)
full_path = os.path.join(directory, file_name)
if self.conf('create_subdir'): if self.conf('create_subdir'):
try: try:
new_path = os.path.splitext(fullPath)[0] new_path = os.path.splitext(full_path)[0]
if not os.path.exists(new_path): if not os.path.exists(new_path):
os.makedirs(new_path) os.makedirs(new_path)
fullPath = os.path.join(new_path, self.createFileName(data, filedata, movie)) full_path = os.path.join(new_path, file_name)
except: except:
log.error('Couldnt create sub dir, reverting to old one: %s', fullPath) log.error('Couldnt create sub dir, reverting to old one: %s', full_path)
try: try:
if not os.path.isfile(fullPath): if not os.path.isfile(full_path):
log.info('Downloading %s to %s.', (data.get('protocol'), fullPath)) log.info('Downloading %s to %s.', (data.get('protocol'), full_path))
with open(fullPath, 'wb') as f: with open(full_path, 'wb') as f:
f.write(filedata) f.write(filedata)
os.chmod(fullPath, Env.getPermission('file')) os.chmod(full_path, Env.getPermission('file'))
return True return True
else: else:
log.info('File %s already exists.', fullPath) log.info('File %s already exists.', full_path)
return True return True
except: except: