Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disc template KeyError #279

Closed
spvkgn opened this issue Jun 30, 2018 · 3 comments
Closed

Disc template KeyError #279

spvkgn opened this issue Jun 30, 2018 · 3 comments
Assignees
Labels
Bug Generic bug: can be used together with more specific labels
Milestone

Comments

@spvkgn
Copy link

spvkgn commented Jun 30, 2018

$ WHIPPER_DEBUG=DEBUG WHIPPER_LOGFILE=whipper.log whipper cd rip
Using configured read offset 48
Checking device /dev/sr0
Reading TOC...
CDDB disc id: 630e1d08
MusicBrainz disc id ibP6iFiB14iye.JALRZ9kCdLmD8-
MusicBrainz lookup URL https://musicbrainz.org/cdtoc/attach?toc=1+8+271159+150+46261+79254+109237+125375+145820+202649+242631&tracks=8&id=ibP6iFiB14iye.JALRZ9kCdLmD8-
Disc duration: 01:00:13.453, 8 audio tracks

Matching releases:

Artist  : The Pax Cecilia
Title   : Blessed Are the Bonds
Duration: 01:00:13.451
URL     : https://musicbrainz.org/release/428a9519-b114-4cc1-8080-9fb71997ad11
Release : 428a9519-b114-4cc1-8080-9fb71997ad11
Type    : Album

Traceback (most recent call last):
  File "/usr/bin/whipper", line 11, in <module>
    load_entry_point('whipper==0.7.0', 'console_scripts', 'whipper')()
  File "/usr/lib/python2.7/dist-packages/whipper/command/main.py", line 36, in main
    ret = cmd.do()
  File "/usr/lib/python2.7/dist-packages/whipper/command/basecommand.py", line 139, in do
    return self.cmd.do()
  File "/usr/lib/python2.7/dist-packages/whipper/command/basecommand.py", line 139, in do
    return self.cmd.do()
  File "/usr/lib/python2.7/dist-packages/whipper/command/cd.py", line 181, in do
    self.doCommand()
  File "/usr/lib/python2.7/dist-packages/whipper/command/cd.py", line 320, in doCommand
    self.program.metadata)
  File "/usr/lib/python2.7/dist-packages/whipper/common/program.py", line 240, in getPath
    return os.path.join(outdir, template % v)
KeyError: u't'
$ cat ~/.config/whipper/whipper.conf 
[drive:PIONEER%20%3ADVD-RW%20%20DVR-109%20%3A1.58]
vendor = PIONEER
model = DVD-RW  DVR-109
release = 1.58
defeats_cache = True
read_offset = 48

[whipper.cd.rip]
unknown = True
output_directory = ~/Music
track_template = %%A - %%d (%%y)/%%t. %%n
disc_template = %(track_template)s

When I delete [whipper.cd.rip] section, this error not occurs.

whipper.log.gz

@RecursiveForest
Copy link
Contributor

RecursiveForest commented Jul 5, 2018

If you single quote your track_template line, does the crash still occur?

track_template = '%%A - %%d (%%y)/%%t. %%n'

If you could include a debug log in your report that would be helpful: https://github.com/JoeLametta/whipper#bug-reports--feature-requests

Thanks for bringing this to our attention. :)

@spvkgn
Copy link
Author

spvkgn commented Jul 6, 2018

@RecursiveForest Single quoting does not help, it crashes with same error.

Thanks for your answer, please see log file attached in first comment.

@RecursiveForest
Copy link
Contributor

RecursiveForest commented Jul 6, 2018

Okay, the bug is partially in our documentation. If you edit the disc_template line to something like disc_template = %%A - %%d (%%y) you should not experience a crash.

The "%t" format type is only applicable to the track_template-- attempting to use it in the disc template is causing a crash. Our code should handle this gracefully instead of crashing.

Our documentation should say something like:

disc_template = %%A - %%d (%%y)
track_template = %(disc_template)s/%%t. %%n

@JoeLametta JoeLametta added the Bug Generic bug: can be used together with more specific labels label Sep 3, 2018
@JoeLametta JoeLametta self-assigned this Sep 3, 2018
@JoeLametta JoeLametta added this to the 1.0 milestone Sep 3, 2018
@JoeLametta JoeLametta changed the title whipper.cd.rip issue Disc template issue Nov 2, 2018
@JoeLametta JoeLametta changed the title Disc template issue Disc template KeyError Nov 2, 2018
JoeLametta added a commit that referenced this issue Nov 2, 2018
If the template string contains variables which aren't valid for whipper, raise ValueError exception listing all the included unrecognized variables.
I've also corrected the example template configuration lines in the README.

Fixes #279.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Generic bug: can be used together with more specific labels
Projects
None yet
Development

No branches or pull requests

3 participants