whipper-team / whipper

Python CD-DA ripper preferring accuracy over speed
GNU General Public License v3.0
1.11k stars 88 forks source link

`KeyError` crash when ripping unknown disc with `%N` in track template #585

Open elomatreb opened 1 year ago

elomatreb commented 1 year ago

I tried ripping a disc that was not yet added to MusicBrainz (with the --unknown option), and I had the following track_template: %%A - %%d/%%N-%%t %%n.

This then resulted in the following crash:

Traceback (most recent call last):
  File "/usr/bin/whipper", line 33, in <module>
    sys.exit(load_entry_point('whipper==0.10.0', 'console_scripts', 'whipper')())
  File "/usr/lib/python3.10/site-packages/whipper/command/main.py", line 56, in main
    ret = cmd.do()
  File "/usr/lib/python3.10/site-packages/whipper/command/basecommand.py", line 141, in do
    return self.cmd.do()
  File "/usr/lib/python3.10/site-packages/whipper/command/basecommand.py", line 141, in do
    return self.cmd.do()
  File "/usr/lib/python3.10/site-packages/whipper/command/cd.py", line 203, in do
    ret = self.doCommand()
  File "/usr/lib/python3.10/site-packages/whipper/command/cd.py", line 559, in doCommand
    _ripIfNotRipped(i + 1)
  File "/usr/lib/python3.10/site-packages/whipper/command/cd.py", line 420, in _ripIfNotRipped
    path = self.program.getPath(self.program.outdir,
  File "/usr/lib/python3.10/site-packages/whipper/common/program.py", line 244, in getPath
    return os.path.join(outdir, template % v_fltr)
KeyError: 'N'

Removing %%N from the template string allowed me to rip the disc successfully.

github-actions[bot] commented 1 year ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing instructions.