Default cost is 1, don't show cost in edit if cost is 1
This commit is contained in:
parent
d8bb41ed17
commit
ddcbe8fbab
1 changed files with 11 additions and 3 deletions
|
|
@ -26,7 +26,7 @@ def do_modify_labels(lib, objs, label, action):
|
|||
|
||||
if action == 0:
|
||||
if len(split) == 1:
|
||||
labels[label] = 0
|
||||
labels[label] = 1
|
||||
else:
|
||||
labels[split[0]] = int(split[1])
|
||||
elif label in labels:
|
||||
|
|
@ -185,8 +185,14 @@ def edit_labels(lib, opts, args):
|
|||
temp_file.write(f"{item.artist} - {item.title}:\n")
|
||||
else:
|
||||
temp_file.write(f"{item.title}:\n")
|
||||
|
||||
for key in sorted(labels.keys()):
|
||||
temp_file.write(f" - {key}: {labels[key]}\n")
|
||||
temp_file.write(f"- {key}")
|
||||
|
||||
if labels[key] > 1:
|
||||
temp_file.write(f": {labels[key]}")
|
||||
|
||||
temp_file.write("\n")
|
||||
temp_file.write("\n") # Blank line between items
|
||||
|
||||
temp_file.close()
|
||||
|
|
@ -234,7 +240,7 @@ def edit_labels(lib, opts, args):
|
|||
while i < len(lines):
|
||||
label_line = lines[i]
|
||||
# Check if this is a label line (starts with " - ")
|
||||
if label_line.startswith(' - '):
|
||||
if label_line.startswith('- '):
|
||||
# Parse: " - key: value"
|
||||
label_content = label_line.strip()[2:].strip() # Remove " - "
|
||||
if ':' in label_content:
|
||||
|
|
@ -245,6 +251,8 @@ def edit_labels(lib, opts, args):
|
|||
new_labels[key] = int(val)
|
||||
except ValueError:
|
||||
print_(f"Warning: Invalid value for label '{key}' in item '{item.title}', skipping")
|
||||
else:
|
||||
new_labels[label_content.strip()] = 1
|
||||
i += 1
|
||||
else:
|
||||
# Not a label line, done with this item
|
||||
|
|
|
|||
Loading…
Reference in a new issue