Select all tracks, which Genre, for example, equal "Rock"

Can I select all files from the directory ~/music with Genre=Rock (mp3 tag) and add their to playlist? If yes, then How do it?

Not directly but if you want, you can use a script:
<br /> cd ~/music<br /> find ./ -regex '^.*\.mp3$' -exec bash -c "id3v2 -l \"{}\" | grep -i rock &amp;&amp; mocp -a \"{}\"" \;<br />

This will add all the rock tagged stuff to the playlist. It may take some time if your directory is big.
You may want to use this script as an ExecCommand; you could assign it to F1 for instance.
Name this script findrock.sh and place it in ~/.moc/:
<br /> #!/bin/bash<br /> if [ -d "$1" ]; then<br /> cd "$1"<br /> else<br /> cd "$(dirname "$1")"<br /> fi<br /> nohup find ./ -regex '^.*\.mp3$' -exec bash -c "id3v2 -l \"{}\" | grep -i rock &amp;&amp; mocp -a \"{}\"" \; &gt; /dev/null<br />

Make it executable:
<br /> chmod a+x ~/.moc/findrock.sh<br />

and edit your ~/.moc/ and add this:
<br /> ExecCommand1 = "$HOME/.moc/findrock.sh %f"<br />

Now, when you press F1 in moc, moc will recursively search the folder you're in for 'rock' files.
I didn't test this so there may be a few mistakes.

(You need id3v2 utility (under debian: sudo apt-get install id3v2))

Thank you very much!
You wrote the good article for the faq.
I slightly modified the script:
<br /> #!/bin/bash<br /> SEARCH=genre.*ambient</p> <p>if [ -d "$1" ]<br /> then cd "$1"<br /> else cd "$(dirname "$1")"<br /> fi</p> <p>nohup find ./ -regex '^.*\.mp3$' 2&gt;/dev/null | \<br /> sort | \<br /> while read line<br /> do<br /> eyeD3 "$line" 2&gt;/dev/null | \<br /> grep -i "$SEARCH" &amp;&amp; mocp -a "$line"<br /> done &gt;/dev/null &amp;<br />

Improvements:

  • playlist sorted
  • runs in the background
  • errors are redirected to /dev/null