Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Sep 2014, 02:17
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
How to tag all your audio files in the fastest possible way
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [25 Posts]   Goto page: 1, 2 Next
Author Message
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Tue 28 Feb 2012, 09:44    Post subject:  How to tag all your audio files in the fastest possible way  

From this article:
Quote:
By Marco Fioretti
February 23, 2012, 9:00 AM PST

Takeaway: Marco Fioretti shows you his method for tagging MP3 files with as much automation as possible so that you can impose a little order on music or other audio collections.

Quote:
....And now one shell way to tag MP3 files

The easiest way to prepare non-song MP3 files for proper tagging is to give them consistent and meaningful names. Once that precondition is verified, you can automatically use those names to write tags with a script like this:
Code:
 1 #! /bin/bash

   2

   3 for SONG in `find $1 -type f -name "*mp3"`

   4     do

   5        TITLE=`basename $SONG | cut -d_ -f1 | tr "-" " "`

   6        LEAD=`basename  $SONG | cut -d_ -f2 | tr "-" " "`

   7        YEAR=`basename  $SONG | cut -d_ -f3 | cut -c1-4`

   8        id3tag   --song="\"$TITLE\"" $SONG

   9        id3tag  --album="\"$TITLE\"" $SONG

  10        id3tag --artist="\"$LEAD\"" $SONG

  11        id3tag       -y$YEAR $SONG

  12     done

  13     exit
Quote:
Here I assume that each file has a name in the format TITLE_LEAD_DATE.mp3, with the first four characters of the DATE being the YEAR of recording. Of course, once you get the trick, you can easily hack the script to work with any other (constant!) naming format. Lines 5 to 7 extract title, lead and year from the file name, replacing hyphens with spaces: a file named The-Wall_Pink-Floyd-19791130.mp3 will return “The Wall” for TITLE, “Pink Floyd” as LEAD and 1979 as YEAR. Once these strings are inside shell variables, we only have to call the id3tag program (lines 8 to 11) to write each tag inside the file. Easy, isn’t it?

First of all, will this work in any Puppy?

For years I've been looking for an easy way to tag mp3 files so the author, book title and file number shows in the mp3 player while the file is playing. Particularly, I want the tag file name to be the same as the file name that shows in ROX. I use Asunder in Puppy to convert audio books to mp3 so that I can listen to them on a generic mp3 player (NOT an iPod). The problem is that audio books have hundreds of files, typically around two hundred. I haven't found an automatic way to go back and tag each file so the mp3 player shows the information I want it to show while the file is playing.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Tue 28 Feb 2012, 12:34    Post subject:  

Why not use the Puppy builtin tool?
This tool is meant exactly for your case.
Tag either tracks in Playlist or Music-Sources. See menu.

The information also shows example code for audio-books. Here follows all the info text:

Code:
Advanced tagging

For advanced tagging you can use commands instead of
static text in the fields. This is very useful to track-titles
which almost never will be equal to another one. Some examples:

Filename is 'artist - title.mp3'. Command to grab title will be:
exe:echo 'FILENAME' | awk -F ' - ' '{print \$2}'

Album might be the name of the directory:
exe:echo 'DIRNAME'

Track-title in an e-book could be named like this:
exe:echo 'Mybook - Track COUNT'

And then the rules:
- Line must start with exe:
- Builtin variables are FILENAME, DIRNAME and COUNT
- Never use "
- Place a \ in front of $




_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Tue 28 Feb 2012, 22:57    Post subject:  

Thanks, Zigbert, I'll try it. Smile I think I did tinker around with it a while back. I don't remember what the results were.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Wed 29 Feb 2012, 05:09    Post subject:  

Flash wrote:
I think I did tinker around with it a while back. I don't remember what the results were.
Pmusic has evolved quickly the last year, and that often leads to bugs. Things has started to settle, and focus is switched to stabilizing.... Please report any issues.


Thank you
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Sat 03 Mar 2012, 22:40    Post subject:  

Okay, here are the early results. Yesterday I installed the latest Pmusic 2.4.4.1 and tried it but the results were the same so I didn't save it when I shut down. I'll just report here on the version that came with Racy Puppy 5.2.1.90 (Pmusic 2.2.1).

First, I find it difficult to understand what everything means. That is due to my own ignorance of what the terms mean, such as Playlist, Music sources, etc.. Perhaps you could include a list of terms and their definitions?

Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX. The first one should be 01 - 64, the second one 02 - 64, and so on to 64 - 64. Clicking the column headings didn't change anything. For a second after they begin to load into the playlist window, they are properly numbered and in order, but after a few seconds they change to what you see in the first attachment.

Thinking that tagging them might reorder them properly, I clicked "Tag all tracks in list" then filled in what I thought were the fields I cared about. The result is as you see in the second attachment.

So the first problem is, it appears that Pmusic can't properly display more than 20 or 40 tracks in a directory, or am I doing something wrong? Be advised that some audiobooks have well over a thousand tracks.

I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.

I didn't think to try selecting all the files in the ROX directory and dragging them into Pmusic's playlist window. Would that work in Pmusic 2.4.4.1?
Pmusic tag-all-tracks-in-directory.jpg
 Description   
 Filesize   92.99 KB
 Viewed   752 Time(s)

Pmusic tag-all-tracks-in-directory.jpg

Pmusic tag-all-tracks result.jpg
 Description   
 Filesize   164.93 KB
 Viewed   744 Time(s)

Pmusic tag-all-tracks result.jpg

Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Sun 04 Mar 2012, 04:53    Post subject:  

Flash
Reading the Pmusic changelog, version 2.2.1 should be fine

Quote:
First, I find it difficult to understand what everything means. That is due to my own ignorance of what the terms mean, such as Playlist, Music sources, etc.. Perhaps you could include a list of terms and their definitions?
I do not advertise my english skills, so any improvement are welcome. Regarding 'playlist' and 'music-sources', these terms are taken from other audio-players, because I am not the man to find any better.

Quote:
Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX
Will look into this.

Quote:
So the first problem is, it appears that Pmusic can't properly display more than 20 or 40 tracks in a directory, or am I doing something wrong? Be advised that some audiobooks have well over a thousand tracks.
The Pmusic 'Playlist' struggles when displaying many tracks. How many depends on the system you are running. For me that is 300-400. On the other hand, the 'Music-Source' list are able to show my 24000 tracks in a blink of an eye. You can tag all tracks in this list as well (see Music-Source menu).

Quote:
I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.
The list is the id3-genre-standard, and has most focus on music. But, it would be logical to accept manual entries. I have added it to the todo list.

Quote:
I didn't think to try selecting all the files in the ROX directory and dragging them into Pmusic's playlist window. Would that work in Pmusic 2.4.4.1?
You're correct - It would not.


Thank you for the feedback.
I will make an update, and hopefully be able to tag your books in some near future.
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Sun 04 Mar 2012, 08:34    Post subject:  

zigbert wrote:
I do not advertise my english skills, so any improvement are welcome. Regarding 'playlist' and 'music-sources', these terms are taken from other audio-players, because I am not the man to find any better.

I'll work on suggested definitions as I grow to understand them myself.

Quote:
Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX
Will look into this.

Quote:
... the 'Music-Source' list are able to show my 24000 tracks in a blink of an eye. You can tag all tracks in this list as well (see Music-Source menu).

Ah, I didn't realize this. Thanks, I'll try it.

Quote:
Thank you for the feedback.
I will make an update, and hopefully be able to tag your books in some near future.
Sigmund

Thank you. Smile By the way, would you rather we continue this discussion in the Pmusic thread?
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Sun 04 Mar 2012, 11:23    Post subject:  

Flash
Quote:
I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.
I am NOT able to tag a not-supported genre-tag with id3tag. - Which is the tagging command used in Pmusic. You might skip this, or use some tag close enough (101 - speech) ??? It is possible to add a comment-tag, but I have skipped this for Pmusic (so far).

From your screenshots, I understands that the term 'Track' is completely insane, as it easily is seen as the name of the track (Title is meant for this). Now called 'Track Nr' as it represent the number of the track in the album list. So the correct command for auto-tagging 'Track Nr' should be
Code:
exe:echo 'COUNT'
or
Code:
exe:echo 'COUNT - 64'


Quote:
Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX
Ok, Pmusic will add the tracks to 'Playlist' in the same order as shown in 'Music-Source' list. If sort order is not correct in search-result or in browser (I check here, and browsing seems to work ok.), you can sort by filename or tags from the 'Music-Source' menu to override this. This is of course very helpful when masstagging track numbers. Correct sort order is the only way to get correct track-number-tag.



I don't really care in what thread we meet Very Happy
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Tue 06 Mar 2012, 00:16    Post subject:  

Since Racy Puppy has id3tag, I thought I'd play around with it a bit. I didn't get far because I couldn't find a way to see what I'd done. How does one "read" the id3tag of a mp3 file?
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Tue 06 Mar 2012, 11:49    Post subject:  

Flash wrote:
Since Racy Puppy has id3tag, I thought I'd play around with it a bit. I didn't get far because I couldn't find a way to see what I'd done. How does one "read" the id3tag of a mp3 file?

Don't know about Racy, but Lupu has id3info:

Code:
id3info "song name.mp3"


Quote:
Quote:

I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.

The list is the id3-genre-standard, and has most focus on music. But, it would be logical to accept manual entries. I have added it to the todo list.


Until then, DeadBeef supports custom genres. And Pmusic displays them correctly.

HTH
Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Tue 06 Mar 2012, 14:53    Post subject:  

If someone could help out, it seems rather easy to skip the id3-lib and edit the tags on-the-fly. Look at this:

1.) This is the tag info of my Stage Dolls track using id3info
# id3info ./Stage\ dolls\ -\ Wings\ of\ steel.mp3
*** Tag information for ./Stage dolls - Wings of steel.mp3
=== TIT2 (Title/songname/content description): Wings of Steel
=== TPE1 (Lead performer(s)/Soloist(s)): Stage Dolls
=== TALB (Album/Movie/Show title): Stage Dolls
=== TYER (Year): 198
=== TRCK (Track number/Position in set): 4



2.) Now let's look at the file directly using cat.
# cat -A ./Stage\ dolls\ -\ Wings\ of\ steel.mp3 | grep ID3
ID3^D^@^@^@^@^@{TPE1^@^@^@^M^@^@^CStage Dolls^@TALB^@^@^@^M^@^@^CStage Dolls^@TIT2^@^@^@^P^@^@^CWings of Steel^@TRCK^@^@^@^C^@^@^C4^@TDRL^@^@^@^F^@^@^C1988^@TSSE^@^@^@^L^@^@^CLavf53.4.0^@M-^?M-{0^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Xing^@^@^@^G^@^@^^M-m^@KM-=.^@^C^E^H$
^VT^B`T'IjM-S^Y*,jM-vM-TM-s^\M-^BQM-lV#UM-d^VM-MM-aM-^J^LXSM-CM-RM-=uM-[M-^ZM-PM-:M-YM-|DM-^U)M-`fM-{UY^[M-=M-+M-^LM-6M-!bM-^J#0M-^PM-,E|^N^ZM-^ID3M-%YNM-GM-bG(5M--M-C'^\M-^BM-HM-T^UM-4M-i^H^PM-*M-OrsWM-%M-H^XM-TM-D^RM-iM-KM-_M-^MK!M-wM-|M-^_M-_M-vM-!pnM-LM-^RM-&vg5^VM-^WM-FN<H^D5bM-WM-n^RM-#M-~rOM-^IO!M-&^TM-^?M-{M-2dM-n^HM-^UM-.jYS^OKpM-^DLM-;!=M-^FnUM-IM-+`LM-=-M-AM-^QM-0mTM-tM-^UM-8M-^BM-JM-^WM-3M-6M-.'^\M-~M-^OM-;M-^IM-!M-^M]"iNM-^_QM-^U^QM-Y]M-4M-Z\M-^EM-4M-^Y^Y^Y-M-Iwm^UM-*/4M-"M-5TvM->M-m^?M-5UM-UM-^NM-|M-~M-^?M-^MM-wM-|UwM-5M-(M-uM-;M-^UM-QM-ZgiM-^PM-7i^SM-Jk.M-JM-^HM-wJu:M- MM-M-^QNM-^ZM-3ZM-eM-wvM-hM-H->M-^EM-)TM-ZM-XM-O#|yM-^ZM-wM-P[XM-OE^DM-^P$



3.) What if we change the first 'Stage' to 'Puppy'
# sed -i "s/Stage/Puppy/" ./Stage\ dolls\ -\ Wings\ of\ steel.mp3


4.) And the result is just what we want....
# cat -A ./Stage\ dolls\ -\ Wings\ of\ steel.mp3 | grep ID3
ID3^D^@^@^@^@^@{TPE1^@^@^@^M^@^@^C
Puppy Dolls^@TALB^@^@^@^M^@^@^CStage Dolls^@TIT2^@^@^@^P^@^@^CWings of Steel^@TRCK^@^@^@^C^@^@^C4^@TDRL^@^@^@^F^@^@^C1988^@TSSE^@^@^@^L^@^@^CLavf53.4.0^@M-^?M-{0^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Xing^@^@^@^G^@^@^^M-m^@KM-=.^@^C^E^H$
^VT^B`T'IjM-S^Y*,jM-vM-TM-s^\M-^BQM-lV#UM-d^VM-MM-aM-^J^LXSM-CM-RM-=uM-[M-^ZM-PM-:M-YM-|DM-^U)M-`fM-{UY^[M-=M-+M-^LM-6M-!bM-^J#0M-^PM-,E|^N^ZM-^ID3M-%YNM-GM-bG(5M--M-C'^\M-^BM-HM-T^UM-4M-i^H^PM-*M-OrsWM-%M-H^XM-TM-D^RM-iM-KM-_M-^MK!M-wM-|M-^_M-_M-vM-!pnM-LM-^RM-&vg5^VM-^WM-FN<H^D5bM-WM-n^RM-#M-~rOM-^IO!M-&^TM-^?M-{M-2dM-n^HM-^UM-.jYS^OKpM-^DLM-;!=M-^FnUM-IM-+`LM-=-M-AM-^QM-0mTM-tM-^UM-8M-^BM-JM-^WM-3M-6M-.'^\M-~M-^OM-;M-^IM-!M-^M]"iNM-^_QM-^U^QM-Y]M-4M-Z\M-^EM-4M-^Y^Y^Y-M-Iwm^UM-*/4M-"M-5TvM->M-m^?M-5UM-UM-^NM-|M-~M-^?M-^MM-wM-|UwM-5M-(M-uM-;M-^UM-QM-ZgiM-^PM-7i^SM-Jk.M-JM-^HM-wJu:M- MM-M-^QNM-^ZM-3ZM-eM-wvM-hM-H->M-^EM-)TM-ZM-XM-O#|yM-^ZM-wM-P[XM-OE^DM-^P$



# id3info ./Stage\ dolls\ -\ Wings\ of\ steel.mp3
*** Tag information for ./Stage dolls - Wings of steel.mp3
=== TIT2 (Title/songname/content description): Wings of Steel
=== TPE1 (Lead performer(s)/Soloist(s)):
Puppy Dolls
=== TALB (Album/Movie/Show title): Stage Dolls
=== TYER (Year): 198
=== TRCK (Track number/Position in set): 4




But it is not THAT straightforward. The ID3 information (using cat) also someway shows how many bytes used for the specific tag. If I change 'Stage' to 'Pup' the tag gets corrupted. If someone can tell how the calculation works, we could probably get our own tagger. - With the features we require. Also libid3(tag) is 780kb uncompressed in the latest Slacko.


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Tue 06 Mar 2012, 16:55    Post subject:  

I've discovered that neither id3tag nor id3info will work if there are spaces in the filename. Evil or Very Mad
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 06 Mar 2012, 17:04    Post subject:  

Flash wrote:
I've discovered that neither id3tag nor id3info will work if there are spaces in the filename. Evil or Very Mad

Do use escapes '\' id3info ./Stage\ dolls\ -\ Wings\ of\ steel.mp3.
jpeps did show me this one.

_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5728
Location: Valåmoen, Norway

PostPosted: Tue 06 Mar 2012, 19:59    Post subject:  

This might be a better solution
Code:
ffmpeg -i ./Stage\ dolls\ -\ Wings\ of\ steel.mp3 -acodec copy -metadata genre=audiobook -y /tmp.mp3
mv -f /tmp.mp3 ./Stage\ dolls\ -\ Wings\ of\ steel.mp3

I have not compared the speed with libid3
At the moment, it supports only m4a, mp3, wma and rm.


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Tue 06 Mar 2012, 23:22    Post subject:  

RSH wrote:
Flash wrote:
I've discovered that neither id3tag nor id3info will work if there are spaces in the filename. Evil or Very Mad

Do use escapes '\'

Thanks. I didn't realize what the backslashes were for. Embarassed

Zigbert, I'll try your solution soon. Tomorrow I hope. Smile
(How do you make any sense out of ffmpeg --help? It's a thousand options all jumbled together in no apparent order. I couldn't find the -i option.)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [25 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1223s ][ Queries: 13 (0.0051s) ][ GZIP on ]