Saturday, November 9, 2013

Bulk Mp3 id3-tagger using Yad and Id3-tagger Python Module

I like doing most of things on Linux using CLI ,it is easy , time-saving and more effecient, but some times it is great to have alternative tools with nice GUI to do the same job, especially for the average user who are frightened to open the terminal and type anything
This is a little bash script built using Yad to edit id3-tags (Artist and Album Title for the time being) ,
Python2 , Id3-tagger Module 

  1. m=$(yad --file-selection --multiple --geometry=600x400+20+20 --file-filter="MP3 | *.mp3" --title="Bulk Mp3 ID3-Tagger Tool");FILE_ARRAY=(`echo $m | tr "|" "\n"`);
  2. Album_artist=$(yad --form --field='Album Title' --field='Artist');STR_ARRAY=(`echo $Album_artist | tr "|" "\n"`);
  3. for f in ${FILE_ARRAY[@]}
  4. do
  5. #echo "> [[$f]]"
  6. if [[ ! -z "${STR_ARRAY[0]}" ]] && [[ ! -z "${STR_ARRAY[1]}" ]];then
  7. python2 /usr/bin/ -a ${STR_ARRAY[1]} -A ${STR_ARRAY[0]} $f;
  8. yad --text="Artist changed to ${STR_ARRAY[1]} Album changed to ${STR_ARRAY[0]}" --title="Bulk Mp3 ID3-Tagger Tool"
  9. #if [[ ! -z "${STR_ARRAY[0]}" ]];then
  10. # python2 /usr/bin/ -A ${STR_ARRAY[[0]]} $f
  11. # yad --text="Album changed to ${STR_ARRAY[[0]]}"
  12. #if [[ ! -z "${STR_ARRAY[1]}" ]];then
  13. # python2 /usr/bin/ -a ${STR_ARRAY[1]} $f
  14. # yad --text="Artist changed to ${STR_ARRAY[1]}"
  15. else
  16. yad --text="nothing to be done.You have to fill both fileds" --title="Bulk Mp3 ID3-Tagger Tool";
  17. fi
  18. done
  19. screenshot: