fix error when no logfile is given

This commit is contained in:
Adrian Sampson 2010-06-27 20:04:59 -07:00
parent 76f52f9ea6
commit c76ddd7da8

View file

@ -322,6 +322,8 @@ def import_files(lib, paths, copy=True, write=True, autot=True, logpath=None):
"""
if logpath:
logfile = open(logpath, 'w')
else:
logfile = None
first = True
for path in paths:
@ -341,7 +343,7 @@ def import_files(lib, paths, copy=True, write=True, autot=True, logpath=None):
lib.add(item)
lib.save()
if logpath:
if logfile:
logfile.close()
def list_items(lib, query, album):