Skip to content

Commit 49b729d

Browse files
committed
mutate: remove %a in case of single artist
1 parent b072a77 commit 49b729d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mutate

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ def remove(what, df):
259259
def edit(df, idx, col):
260260
if idx == None:
261261
if col == f_filename:
262-
val = prompt("New template for 'filename': ", default="%n %a - %t")
262+
single_artist = df[f_artist].nunique() == 1
263+
val = prompt(
264+
"New template for 'filename': ",
265+
default = "%%n %s%%t" % ('' if single_artist else "%a - ")
266+
)
263267
zero_pad = None
264268
if '%n' in val and f_num in df.columns:
265269
zero_pad = str(df[f_num].map(lambda x: len(str(x))).max())

0 commit comments

Comments
 (0)