New Posts  All Forums:Forum Nav:

Auto-tagging

post #1 of 12
Thread Starter 
Which script of app you recommend for mass-tagging flac files? Right now I need to swap the artist and title field of 100's of flac files, and I prefer to tell the computer to do it, rather than me.

Hmm, and I think it's easier to find it in the Linux world (hence this post), but if it's for Windows, no problem, I use both.

Thanks!
post #2 of 12
Hmm if you need to swap them, I would say write your own to be honest, either in Bash or Python(Python for me I think

But I don't know of a mass tag swap program in any OS off the top of my head sorry. Tagging while ripping, that is something else.

Seablade
post #3 of 12
Thread Starter 
Could you help me on this one?

#!/bin/bash
for file in *.flac ; do
prevart=$(metaflac --show-tag=ARTIST $file | sed 's/^ARTIST=//')
prevtit=$(metaflac --show-tag=TITLE $file | sed 's/^TITLE=//')
metaflac --remove-tag=ARTIST $file
metaflac --remove-tag=TITLE $file
metaflac --set-tag=ARTIST=$prevtit $file
metaflac --set-tag=TITLE=$prevart $file
done

Right now, it's doing nothing at all. But if I use metaflac on the command line (same syntax, even with variables like "$whatever"), then it works. Sometimes it says "metaflac cannot be used as a pipe". Is that the problem?

thanks

ps.: I remove the tags before changing because metaflac somehow appends new values to existing ones (arbitrarily selecting the character to use: ";"), in the best counterintuitively way of doing things.
post #4 of 12
Code:
for file in *.flac ; do
    prevart=$(metaflac --show-tag=ARTIST "$file" | sed 's/^ARTIST=//')
    prevtit=$(metaflac --show-tag=TITLE "$file" | sed 's/^TITLE=//')
    metaflac --remove-tag=ARTIST "$file"
    metaflac --remove-tag=TITLE "$file"
    metaflac --set-tag=ARTIST="$prevtit" "$file"
    metaflac --set-tag=TITLE="$prevart" "$file"
done
Seablade
post #5 of 12
Basically you needed to put the variables in quotes to prevent bash from trying to break it apart into seperate commands on the commandline. tag
Code:
#!/bin/bash

for file in *.flac ; do
        metaflac --remove-tag=ARTIST "$file"
        metaflac --remove-tag=TITLE "$file"
        metaflac --set-tag=ARTIST='Jars of Clay' "$file"
        title=$(echo $file | sed -e 's/^[0-9][0-9] - //' -e 's/.flac$//')
        echo "Title is " $title 
        metaflac --set-tag=TITLE="$title" "$file"
done

for file in *.flac ; do
        echo $file
        metaflac --show-tag=ARTIST "$file"
        metaflac --show-tag=TITLE "$file"
done
test
Code:
#!/bin/bash
for file in *.flac ; do
    echo $file
    prevart=$(metaflac --show-tag=ARTIST "$file" | sed 's/^ARTIST=//')
    echo 'Previous Artist is ' $prevart
    prevtit=$(metaflac --show-tag=TITLE "$file" | sed 's/^TITLE=//')
    echo 'Previous Title is ' $prevtit
    metaflac --remove-tag=ARTIST "$file"
    metaflac --remove-tag=TITLE "$file"
    metaflac --set-tag=ARTIST="$prevtit" "$file"
    metaflac --set-tag=TITLE="$prevart" "$file"
done
Code:
thomas-vecchiones-computer:~/Music/Temp Seablade$ ./tag
./tag: line 1: !#/bin/bash: No such file or directory
Title is  Overjoyed
Title is  Something Beautiful
Title is  The Valley Song (Sing Of Your Mercy)
Title is  Liquid
Title is  The Eleventh Hour
Title is  Dig
Title is  Redemption
Title is  Love Song For A Savior
Title is  Frail
Title is  Needful Hands
01 - Overjoyed.flac
ARTIST=Jars of Clay
TITLE=Overjoyed
02 - Something Beautiful.flac
ARTIST=Jars of Clay
TITLE=Something Beautiful
03 - The Valley Song (Sing Of Your Mercy).flac
ARTIST=Jars of Clay
TITLE=The Valley Song (Sing Of Your Mercy)
04 - Liquid.flac
ARTIST=Jars of Clay
TITLE=Liquid
05 - The Eleventh Hour.flac
ARTIST=Jars of Clay
TITLE=The Eleventh Hour
06 - Dig.flac
ARTIST=Jars of Clay
TITLE=Dig
07 - Redemption.flac
ARTIST=Jars of Clay
TITLE=Redemption
08 - Love Song For A Savior.flac
ARTIST=Jars of Clay
TITLE=Love Song For A Savior
09 - Frail.flac
ARTIST=Jars of Clay
TITLE=Frail
10 - Needful Hands.flac
ARTIST=Jars of Clay
TITLE=Needful Hands
thomas-vecchiones-computer:~/Music/Temp Seablade$ ./test
01 - Overjoyed.flac
Previous Artist is  Jars of Clay
Previous Title is  Overjoyed
02 - Something Beautiful.flac
Previous Artist is  Jars of Clay
Previous Title is  Something Beautiful
03 - The Valley Song (Sing Of Your Mercy).flac
Previous Artist is  Jars of Clay
Previous Title is  The Valley Song (Sing Of Your Mercy)
04 - Liquid.flac
Previous Artist is  Jars of Clay
Previous Title is  Liquid
05 - The Eleventh Hour.flac
Previous Artist is  Jars of Clay
Previous Title is  The Eleventh Hour
06 - Dig.flac
Previous Artist is  Jars of Clay
Previous Title is  Dig
07 - Redemption.flac
Previous Artist is  Jars of Clay
Previous Title is  Redemption
08 - Love Song For A Savior.flac
Previous Artist is  Jars of Clay
Previous Title is  Love Song For A Savior
09 - Frail.flac
Previous Artist is  Jars of Clay
Previous Title is  Frail
10 - Needful Hands.flac
Previous Artist is  Jars of Clay
Previous Title is  Needful Hands
thomas-vecchiones-computer:~/Music/Temp Seablade$ metaflac --show-tag=ARTIST 10\\ -\\ Needful\\ Hands.flac 
ARTIST=Needful Hands
So that all works here anyways. Let me know if you ahve problems, bash scripting is something I don't mess with often enough. Seablade
post #6 of 12
Thread Starter 
Nevermind, I've found one for Windows (tag&rename) with *exactly* the menu option I wanted (Tools->swap tags). There is even a pre-made preset "Artist <-> Title" (seems many people do this). It was a matter of Ctrl-selecting all the folders that I knew had flacs with swapped tags.

And to think I lost like 1 hour trying to figure out how metaflac worked...

//edited: haha, you were first. Thanks seablade, I will try it.
post #7 of 12
HehHeh I even got my edit in before you as well

Seablade
post #8 of 12
Thread Starter 
I'm slow. I read and read, and type, then change, then type, then post.

Thank you, oh script-master! Since I'm on Windows right now (I was testing that - expensive - program), it worked typing on the command line in cygwin, but not as a script. It may be cygwin driving me nuts (it's not the first time, and not the last). The point is that your solution works flawlessly for the things I want.
post #9 of 12
Heh just poking fun

Yea I got absolutely no experience on Cygwin so I can't help you there sorry. But hope it works for you, as always check it with a small amount in a copied directory first just to make sure.

Of course we could probably do this in Python and have it work on both systems easily I should look that up sometime.

Seablade
post #10 of 12
Thread Starter 
It doesn't matter. Two words: it works. And, after all, I was on cygwin by an accident (I use it under Windows because even there I can't live without things like cat, grep and sed working together). If I need to script something seriously, I will always be on the other side of the boot.

Ah, good luck on python. I don't mind using filthy raw bash scripting. If it works it works!
post #11 of 12
Yea but python is so easy and so powerful....

Hmm that just doesn't come out right no matter how you phrase it

Cue lots of dirty jokes now...

Seablade
post #12 of 12
Thread Starter 
lol whatever...
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux & Other OS's