Commit 574e224f authored by Cédric Marie's avatar Cédric Marie
Browse files

tag-sieve: Add upt command



This command updates the title tag of all tracks with filename.
To get the title from the filename, it removes .flac extension and
leading disc and track numbers.
Signed-off-by: default avatarCédric Marie <cedric.marie@openmailbox.org>
parent 72603b6e
......@@ -38,6 +38,7 @@ print_usage()
printf " Options for \"clean\" command:\n"
printf " -d keep full date (default: keep only the year)\n"
printf " -a multi-artist (read artist in each track)\n"
printf " upt update title tags from filenames\n"
}
print_header()
......@@ -248,6 +249,37 @@ if [ "$command" = "clean" ]; then
exit 0
fi
# -----------------------------------------------------------------------------
# upt
# -----------------------------------------------------------------------------
if [ "$command" = "upt" ]; then
# FLAC files
if [ "$flac_files" != "" ]; then
print_header "Set title from filename in all tracks"
# Set read-write permission
chmod 644 *.flac
ls -1 *.flac |
{
while read file
do
# Remove .flac and leading disc and track numbers
tag_title=`echo ${file%.flac} | sed 's/^[1-9] - //' | sed 's/^[0-9]\+ - //'`
printf "$file: \033[7m$tag_title\033[0m\n"
metaflac --set-tag="TITLE=$tag_title" "$file"
done
}
# Set read-only permission
chmod 444 *.flac
fi
exit 0
fi
# -----------------------------------------------------------------------------
# unknown command
# -----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment