Optional removal of the original file added
This commit is contained in:
+18
-3
@@ -91,9 +91,7 @@ def main():
|
||||
help='Parse and display the tracklist without splitting any files'
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Metadata options (new)
|
||||
# ------------------------------------------------------------
|
||||
# Metadata options.
|
||||
parser.add_argument(
|
||||
'--album',
|
||||
help='Set album name in output metadata (overrides parsed %%al and original album)'
|
||||
@@ -124,6 +122,13 @@ def main():
|
||||
help='Separator used when merging comments (default: "; ")'
|
||||
)
|
||||
|
||||
# NEW: Delete original after successful split.
|
||||
parser.add_argument(
|
||||
'--delete-original',
|
||||
action='store_true',
|
||||
help='Delete the original input file after successful splitting (default: keep)'
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@@ -197,6 +202,16 @@ def main():
|
||||
print(f"Error: {error}")
|
||||
sys.exit(1)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Delete original file if requested and successful.
|
||||
# --------------------------------------------------------------------------
|
||||
if args.delete_original:
|
||||
try:
|
||||
os.remove(args.input_file)
|
||||
print(f"Deleted original file: {args.input_file}")
|
||||
except OSError as e:
|
||||
print(f"Warning: Could not delete original file: {e}")
|
||||
|
||||
print("Done!")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user