From ee11066077d5523248e49283d9603f01094ae5ae Mon Sep 17 00:00:00 2001 From: 80002462 <80002462@sf-express.com> Date: Thu, 9 May 2019 13:27:26 +0800 Subject: [PATCH] fix artist's dict cannot be found exception --- app.py | 6 +++--- requirements.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index c47d771..a1271f5 100644 --- a/app.py +++ b/app.py @@ -54,9 +54,9 @@ def validate_collision(path): def name_format(path, meta): information = { - 'artist': ','.join([artist[0] for artist in meta['artist']]), - 'title': meta['musicName'], - 'album': meta['album'] + 'artist': ','.join([artist[0] for artist in (meta.get('artist') if meta.get('artist') is not None else [])]), + 'title': meta.get('musicName'), + 'album': meta.get('album') } def substitute(matched): diff --git a/requirements.txt b/requirements.txt index 97a6859..db67121 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +Crypto mutagen pycryptodome