bash script to insert id3 tags from file and directories
hi:
i have the id3tool script that outputs and inserts id3 1 tags into mp3 files. i have many mp3s that have no tag at all on my server and would like to tag them according to my directory structure for example if i have: /home/mp3s/artist/album/filename.mp3 i want the id3 tags to be inserted into artist, album and filename into title. i found this script here that is doing the opposite. (organizing mp3s according to id3 tags) http://www.linuxquestions.org/questi...hlight=id3tool thanks for any help. |
Hi,
Do something in the lines of: $ echo "foo/bar/123" | awk -F/ '{print $1,$2,$3}' foo bar 123 You can just change it arround: $ echo "foo/bar/123" | awk -F/ '{print $3, $2, $1}' 123 bar foo Hope this helps -eco |
thanks but i dont know how to connect it to the id3tool
these are the arguments: id3tool [<options>] <filename> -t, --set-title=WORD Sets the title to WORD -a, --set-album=WORD Sets the album to WORD -r, --set-artist=WORD Sets the artist to WORD -y, --set-year=YEAR Sets the year to YEAR [4 digits] sorry... :scratch: |
See if this works; the 'echo' command in front of 'id3tool' is to allow the script to be tested without writing the tags.
If the output is OK just remove the 'echo'. Code:
#!/bin/bash |
Thanks Kenhelm, this is working. The last thing i guess would be to have the script read the folders the files are in so that i dont have to edit the script everytime.
I guess this is simple but i dont know how to do it. for example if file is in /home/user/domain/mp3s/artist/album/file.mp3 the script would ignore /home/user/domain/mp3s/ and use the folders and filename after that to tag the mp3. thanks, this is my last question, i promise. :) |
If you mean tag all the files for every artist and every album then try:-
Code:
for fn in /home/user/domain/mp3s/*/*/*.mp3 |
|
after a few days playing with the script there is actually one more thing i would like it to do.
i would like it to add track number depending on the file list. if i have this files in a folder: song1.mp3 song2.mp3 song3.mp3 anothersongA.mp3 anothersongB.mp3 anothersongC.mp3 i would like to add track numbers according to the filelist so that i get: song1.mp3 >> track 1 song2.mp3 >> track 2 song3.mp3 >> track 3 song8_anothersong.mp3 >> track 4 randomsong.mp3 >> track 5 singer.mp3 >> track 6 the script should read the filelist and add track numbers to each file in order. id3tool -c filename... thanks for any help. |
Hi,
Here is a basic script I came up with. You will need to modify it if you are using spaces: filelist Code:
song1.mp3 Code:
c=`cat filelist|wc -l` Code:
song1.mp3 --> Track_1 |
thanks. i guess this is taking the last filenumber and using it to insert tracks???
that is good but not exactly what i need because some of my files dont have a number and are mixed with many others. i would prefer if the script would just read the file list using "ls" and add tracks to all files in order. is this possible? thanks and sorry for the inconvenience. |
Quote:
Not exactly. It's counting the number of lines Code:
c=`cat filelist|wc -l` Code:
`seq 1 $c` man bash is your friend ;) Is it what you needed after all? It's basically taking the files in the order of the list and adding the 'line number' to it. |
|
For the record, krename can rename files using id3/metadata tags and directory structures. Most gui tagging tools such as easytag and audiotagtools can also rename files from tags, and I believe you can usually add a directory path to the name with some of them as well.
|
Quote:
Best of luck and don't give up, it's so much fun! Cheers, -eco |
Hi.
I wondered if someone could help me. I have all my songs organized like this: <artist>/<album> (<year>)/<track number> <title>.mp3 EXAMPLE Aphex Twin/Windowlicker (1999)/01 Windowlicker.mp3 ...with the exception that I sometimes do not include the year, like this: <artist>/<album>/<track number> <title>.mp3 (if this isn't possible, let's say I always include the year) In addition I would like all previous ID3 tags other than artist, album, year, track number and title to be removed, before the mentioned ones are applied. What would the script look like then? Code:
-t, --set-title=WORD Sets the title to WORD Also, I'm not a programmer in any way, so some guidance into how to execute scripts with id3tool is welcome. ;) |
Can somebody please help me, please?
|
All times are GMT -5. The time now is 06:47 PM. |