Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

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) ,
requirements
Yad
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/id3-tagger.py -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/id3-tagger.py -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/id3-tagger.py -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:

Monday, September 2, 2013

Editing ID3 tags from command line using Python.

You can build a Python module from scratch just to edit ID3 tags, but there is no need to reinvent the wheel since there are many modules ready for this job.I have been using http://id3-py.sourceforge.net which is very straightforward , anyway, here is a little How-to
* Download the module and extract it to any directory you like
* Navigate to the directory where you extracted the module to
cd /ID3/id3-py-1.2
*Install the module
sudo python setup.py install
* If there is no errors , you are ready to go.
download this python script created by the same author ,
http://id3-py.sourceforge.net/ID3/id3-tagger.py
make it executable
chmod  a+x id3-tagger.py
 , you can copy the file to the home directory for an easier access
we are almost done,
here is an example on how to use the file
find ./ -d 1 -name '*.mp3' -exec ~/id3-tagger.py -A 'soundcloud' {} \;

this command will search for any mp3 file in the directory [not recursively] , then will modify the Album tag to soundcloud , you can modify/add different tags to the command as you wish.

Monday, October 22, 2012

Python script to check integrity of SFV files ...


SFV Checker in Python...
I was looking for alternative to sfv checker I used to rely on when I use Linux regularly ... some alternative tools were created on windows  but I thought of making my own script ...Python was my first choice..
usually I use Perl for my scripts,although the same idea(sfv verification) was doable in Perl but requires installing some Modules, so I decided to stick to Python.

here is a link to the script
http://pastie.org/5101158
any feedback is welcomed =)

How to use the script:
providing python is installed
Python sfv.py "sfv_file.sfv"