Skip to content

Commit

Permalink
Default %S to 'Unknown Artist'
Browse files Browse the repository at this point in the history
When metadata is absent,
the %S template variable does not have a default value set in the dictionary,
which can cause a "KeyError: 'S'" error.

While %A defaults to 'Unknown Artist' and %S might conventionally default to 'Artist, Unknown',
defaulting %S to that is unnecessary,
because manual tagging typically follows to assign the correct name.
Therefore, I default %S to 'Unknown Artist', just like %A.

Signed-off-by: sinofp <[email protected]>
  • Loading branch information
sinofp committed Aug 30, 2024
1 parent a4b9742 commit cac1fe5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion whipper/common/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def getPath(self, outdir, template, mbdiscid, metadata, track_number=None):
assert isinstance(outdir, str), "%r is not str" % outdir
assert isinstance(template, str), "%r is not str" % template
v = {}
v['A'] = 'Unknown Artist'
v['S'] = v['A'] = 'Unknown Artist'
v['I'] = v['d'] = v['D'] = mbdiscid # fallback for title
v['r'] = 'unknown'
v['R'] = 'Unknown'
Expand Down

0 comments on commit cac1fe5

Please sign in to comment.