Skip to content

Commit

Permalink
Template: replace None values with empty string
Browse files Browse the repository at this point in the history
Signed-off-by: JoeLametta <[email protected]>
  • Loading branch information
JoeLametta committed May 16, 2021
1 parent 824ab99 commit 0eaf80c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions whipper/common/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ def getPath(self, outdir, template, mbdiscid, metadata, track_number=None):
v['a'] = metadata.artist

template = re.sub(r'%(\w)', r'%(\1)s', template.strip('/'))
v_fltr = {k: self._filter.filter(v2) if isinstance(v2, str) else v2
for k, v2 in v.items()}
# Avoid filtering non str type values, replace None with empty string
v_fltr = {k: self._filter.filter(v2) if isinstance(v2, str) else ''
if v2 is None else v2 for k, v2 in v.items()}
return os.path.join(outdir, template % v_fltr)

@staticmethod
Expand Down

0 comments on commit 0eaf80c

Please sign in to comment.