Allow library to load empty
This commit is contained in:
parent
6638260031
commit
89e0c1838a
10
badwitch.py
10
badwitch.py
@ -25,9 +25,13 @@ class Library:
|
|||||||
|
|
||||||
# Load from file
|
# Load from file
|
||||||
def load(self):
|
def load(self):
|
||||||
with open(self.file, 'r+') as libfd:
|
try:
|
||||||
libfd.seek(0)
|
with open(self.file, 'r+') as libfd:
|
||||||
self.albums = json.load(libfd)
|
libfd.seek(0)
|
||||||
|
self.albums = json.load(libfd)
|
||||||
|
except FileNotFoundError:
|
||||||
|
logging.debug('Could not find library, loading empty')
|
||||||
|
self.albums = {}
|
||||||
return
|
return
|
||||||
|
|
||||||
# Save to file
|
# Save to file
|
||||||
|
Loading…
Reference in New Issue
Block a user