Allow library to load empty

This commit is contained in:
Salt 2020-03-04 02:04:42 -06:00
parent 6638260031
commit 89e0c1838a

View File

@ -25,9 +25,13 @@ class Library:
# Load from file
def load(self):
with open(self.file, 'r+') as libfd:
libfd.seek(0)
self.albums = json.load(libfd)
try:
with open(self.file, 'r+') as libfd:
libfd.seek(0)
self.albums = json.load(libfd)
except FileNotFoundError:
logging.debug('Could not find library, loading empty')
self.albums = {}
return
# Save to file