aboutsummaryrefslogtreecommitdiff
path: root/rebuild.py
diff options
context:
space:
mode:
Diffstat (limited to 'rebuild.py')
-rwxr-xr-xrebuild.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/rebuild.py b/rebuild.py
index 55b0d50..90103b2 100755
--- a/rebuild.py
+++ b/rebuild.py
@@ -65,17 +65,19 @@ def get_books(root_path):
attr = dict()
attr['path'] = file_path
attr['duration'] = tag.duration
- if tag.title:
+ if tag.title and not tag.title.isspace():
attr['title'] = tag.title
else:
- attr['title'] = file_path.split('/')[-1]
- if tag.album:
+ attr['title'] = os.path.split(file_path)[1]
+
+ if tag.album and not tag.album.isspace():
attr['album'] = tag.album
book['title'] = tag.album
else:
- attr['album'] = book_path.split('/')[-1]
- book['title'] = book_path.split('/')[-1]
- if tag.artist:
+ attr['album'] = os.path.split(book_path)[1]
+ book['title'] = os.path.split(book_path)[1]
+
+ if tag.artist and not tag.artist.isspace():
attr['author'] = tag.artist
book['author'] = tag.artist
else: