bum
bum copied to clipboard
cache_dir params not working?
Hi, Thx for this good program, under archlinux i got with python3
❯ bum --cache_dir=/home/cyril/.covers/
Traceback (most recent call last):
File "/usr/bin/bum", line 11, in <module>
load_entry_point('bum==0.1.3', 'console_scripts', 'bum')()
File "/usr/lib/python3.7/site-packages/bum/__main__.py", line 69, in main
song.get_art(args.cache_dir, args.size, client)
File "/usr/lib/python3.7/site-packages/bum/song.py", line 34, in get_art
file_name = cache_dir / file_name
TypeError: unsupported operand type(s) for /: 'str' and 'str'
The problem is probably because default cache_dir
is Pathlib.Path.home() / ".cache/bum"
--> ~/.cache/bum
. If we specifiy cache_dir
, it gets a string so we get your exception above. We need to convert user-defined cache_dir
string to Pathlib.Path
too.
Untested.
diff --git a/bum/__main__.py b/bum/__main__.py
index 76c6868..3c9ac84 100644
--- a/bum/__main__.py
+++ b/bum/__main__.py
@@ -26,9 +26,13 @@ def get_args():
help="what size to display the album art in.",
default=250)
+ def fix_cache_dir(cache_dir):
+ return pathlib.Path(cache_dir)
+
arg.add_argument("--cache_dir", metavar="\"/path/to/dir\"",
help="Where to store the downloaded cover art.",
- default=pathlib.Path.home() / ".cache/bum")
+ default=pathlib.Path.home() / ".cache/bum",
+ type=fix_cache_dir)
arg.add_argument("--version", action="store_true",
help="Print \"bum\" version.")