cli --print / --to-csv breaks when year malformed
Opened this issue · 0 comments
parisni commented
What about using file.raw
to let print / export to csv badformed metadata ?
00:40 $ python3 -m music_tag --to-csv tags.csv sample
Traceback (most recent call last):
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/util.py", line 26, in sanitize_year
year = int(year)
ValueError: invalid literal for int() with base 10: '2019-09-26 10'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/natus/.pyenv/versions/3.9.6/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/natus/.pyenv/versions/3.9.6/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/__main__.py", line 175, in <module>
sys.exit(_main())
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/__main__.py", line 134, in _main
row = [mt_f[k] for k in tags] + [fname]
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/__main__.py", line 134, in <listcomp>
row = [mt_f[k] for k in tags] + [fname]
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/file.py", line 600, in __getitem__
return self.get(norm_key, default=None)
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/file.py", line 443, in get
ret = None if val is None else MetadataItem(md_type, md_sanitizer,
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/file.py", line 67, in __init__
self.values = val
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/file.py", line 90, in values
v = self.sanitizer(v)
File "/home/natus/git/music/.direnv/python-3.9.6/lib/python3.9/site-packages/music_tag/util.py", line 33, in sanitize_year
raise ValueError("Could not extract year from: {0}".format(year))
ValueError: Could not extract year from: 2019-09-26 10