1 of 2
1
Parsing MP3 Metadata (ID3 Tags)
Posted: 09 January 2009 03:57 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

I was just wondering if anyone had ever looked into parsing the metadata (the ID3 tags) for MP3 files. I’m aware that people can associate a title, genre, author, year, comment, duration, bit rate, image and so on with an MP3.

So I was wondering if, rather than have a user enter all this information again into custom fields for a weblog whose entries include mp3’s, they could be automatically pulled from the file?

Any thoughts or ideas anyone?

Profile
 
 
Posted: 09 January 2009 04:29 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29216
Joined  05-15-2004

Check out this plugin, not aware of anything else.

 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
Posted: 09 January 2009 08:08 AM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

Or rather this plugin if you want ID3 (only ID3v1.1 though) information.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 09 January 2009 08:13 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

Thanks Ingmar and Silenz,

The ID3v1.1 is exactly what i need.

Profile
 
 
Posted: 11 January 2009 03:49 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

A hopefully quick question…

I followed the instructions in the documentation for the ID3v1.1 plugin and entered this into my template (first on its own, and then within weblog entries tags).

{exp:mp3info_plus file="http://www.mosaic-church.org.uk/creative_arts_showcase/example.mp3" path="/var/www/vhosts/mosaic-church.org.uk/httpdocs/creative_arts_showcase/"}
Artist
: {artist}<br />
Length: {length}
{
/exp:mp3info}

It doesn’t pull the information from the track and just displays “{artist}” and “{length}”

Any ideas why? the documentation is pretty vague about how/where to use it.
Thanks

Profile
 
 
Posted: 11 January 2009 03:53 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

Haha, as usual, I post a help request and then immediately see where the problem was.

The closing {/exp:mp3info} tag needed to be {/exp:mp3info_plus}

Note: I did copy this straight from the site Silenz linked to so just be aware it will need amending if anybody else does the same. Great little plugin!

Profile
 
 
Posted: 11 January 2009 04:09 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

I’m back again with another issue… I do apologize

Having got the plugin working somewhat correctly, I have discovered having gone through the list of possible variables that it doesn’t actually pull in any of the ID3v1 tags (though I checked and the mp3 files do have the information attached)

And i’ve just noticed that the length parameter brings back the wrong value. In one example it says 5.22 but the track is actually only 4:18. Over a one minute inconsistency!

Any ideas?
Thanks

Profile
 
 
Posted: 11 January 2009 07:39 PM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

Fixed the type with the closing tag.

For the http://www.mosaic-church.org.uk/creative_arts_showcase/example.mp3 I get:

ID3v1 Name:     Night
ID3v1 Artist
:   Killeen and Gieson
ID3v1 Album
:    Miserable Songs
ID3v1 Year
:     2004
ID3v1 Comment
:  http://www.wimpyplayer.com/eco
ID3v1 Track:    
ID3v1 Genre No: 255
ID3v1 Genre
:

Length is somewath off, true. Will look into it.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 12 January 2009 03:58 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

Thanks for having a look.

Theres just one other thing I noticed. In the top left corner of my browser (FF3) there is “no tag no tag” written which must be coming from the plugin as when it’s removed that text isnt displayed.

Any ideas what it could be?

Take a look here http://www.mosaic-church.org.uk/creative_arts/showcase

Thanks again for your time

Profile
 
 
Posted: 12 January 2009 07:21 AM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

That’s a debug message that has been removed in v.1.0.1. It occurs when the plugin encounters an Mp3 that has no properly encoded tags.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 12 January 2009 07:38 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

Great, that debug message has gone now thanks.

Do you plan to develop this plugin further to allow for images/lyrics and so on? I’m just barely scratching the surface of the whole ID3 stuff but it seems it could make for some real useful projects down the line.

Anyway, thanks for putting together this super plugin and for sorting out the problems i was having!

Profile
 
 
Posted: 13 January 2009 05:19 AM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

The plugin will undergo some major changes in the near future, yes.
Do you happen to know a good tag-editor that supports Lyrics?

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 13 January 2009 05:25 AM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  10-22-2008

I’ve been using this one - ID3Editor

Works on Mac and PC

Profile
 
 
Posted: 15 January 2009 10:59 AM   [ Ignore ]   [ # 13 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

Well, the next release will have much improved playtime calculation.

Basic ID3v2-support has been added (see list below) including attached images and unsychronized lyrics.

APIC    [#sec4.15 Attached picture]
COMM    [#sec4.11 Comments]
TALB    [#TALB Album/Movie/Show title]
TCOM    [#TCOM Composer]
TCON    [#TCON Content type]
TCOP    [#TCOP Copyright message]
TIT2    [#TIT2 Title/songname/content description]
TOPE    [#TOPE Original artist(s)/performer(s)]
TPE1    [#TPE1 Lead performer(s)/Soloist(s)]
TPE2    [#TPE2 Band/orchestra/accompaniment]
TPOS    [#TPOS Part of a set]
TPUB    [#TPUB Publisher]
TRCK    [#TRCK Track number/Position in set]
TSSE    [#TSEE Software/Hardware and settings used for encoding]
TYER    [#TYER Year]
USLT    [#sec4.9 Unsychronized lyric/text transcription]

ID3v2.3 has a plethora of possible content frames. Many will probably seldom be used.

I just wonder which of the remaining might be of general interest:

AENC    [#sec4.20 Audio encryption]
COMR    [#sec4.25 Commercial frame]
ENCR    [#sec4.26 Encryption method registration]
EQUA    [#sec4.13 Equalization]
ETCO    [#sec4.6 Event timing codes]
GEOB    [#sec4.16 General encapsulated object]
GRID    [#sec4.27 Group identification registration]
IPLS    [#sec4.4 Involved people list]
LINK    [#sec4.21 Linked information]
MCDI    [#sec4.5 Music CD identifier]
MLLT    [#sec4.7 MPEG location lookup table]
OWNE    [#sec4.24 Ownership frame]
PRIV    [#sec4.28 Private frame]
PCNT    [#sec4.17 Play counter]
POPM    [#sec4.18 Popularimeter]
POSS    [#sec4.22 Position synchronisation frame]
RBUF    [#sec4.19 Recommended buffer size]
RVAD    [#sec4.12 Relative volume adjustment]
RVRB    [#sec4.14 Reverb]
SYLT    [#sec4.10 Synchronized lyric/text]
SYTC    [#sec4.8 Synchronized tempo codes]
TBPM    [#TBPM BPM (beats per minute)]
TDAT    [#TDAT Date]
TDLY    [#TDLY Playlist delay]
TENC    [#TENC Encoded by]
TEXT    [#TEXT Lyricist/Text writer]
TFLT    [#TFLT File type]
TIME    [#TIME Time]
TIT1    [#TIT1 Content group description]
TIT3    [#TIT3 Subtitle/Description refinement]
TKEY    [#TKEY Initial key]
TLAN    [#TLAN Language(s)]
TLEN    [#TLEN Length]
TMED    [#TMED Media type]
TOAL    [#TOAL Original album/movie/show title]
TOFN    [#TOFN Original filename]
TOLY    [#TOLY Original lyricist(s)/text writer(s)]
TORY    [#TORY Original release year]
TOWN    [#TOWN File owner/licensee]
TPE3    [#TPE3 Conductor/performer refinement]
TPE4    [#TPE4 Interpreted, remixed, or otherwise modified by]
TRDA    [#TRDA Recording dates]
TRSN    [#TRSN Internet radio station name]
TRSO    [#TRSO Internet radio station owner]
TSIZ    [#TSIZ Size]
TSRC    [#TSRC ISRC (international standard recording code)]
TXXX    [#TXXX User defined text information frame]
UFID    [#sec4.1 Unique file identifier]
USER    [#sec4.23 Terms of use]
WCOM    [#WCOM Commercial information]
WCOP    [#WCOP Copyright/Legal information]
WOAF    [#WOAF Official audio file webpage]
WOAR    [#WOAR Official artist/performer webpage]
WOAS    [#WOAS Official audio source webpage]
WORS    [#WORS Official internet radio station homepage]
WPAY    [#WPAY Payment]
WPUB    [#WPUB Publishers official webpage]
WXXX    [#WXXX User defined URL link frame]

     

To be able to dynamically display images embedded in mp3s I had to turn the plugin into a module.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 21 January 2009 09:43 AM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

The plugin is now deprecated.

A new version has been released in form of a module. New features have been added and existing ones have been improved.

Note that some variables have changed as well.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 03 February 2009 08:15 PM   [ Ignore ]   [ # 15 ]  
Grad Student
Rank
Total Posts:  70
Joined  02-02-2006

I am trying to use this plugin for a page using related entries.  When doing so, I receive the following error.

Notice: Undefined index: musicdept_song in /home/web/public_html/ee_site/modules/mp3_info/mod.mp3_info.php on line 259

Here is my code for this part of the page.

{exp:weblog:entries weblog="musicdept" category="57"}
{related_entries id
="musicdept_song"}
<tr>
<
p>

{exp:mp3_info:show file="/musicdept/music/You_Are_Holy.mp3" path="/home/web/public_html/musicdept/music"}
Title
: <b>{id3v2_title}</b> <br>
By: {id3v2_artist} <br>
Filesize: {filesize} <br>
Duration: {playtime_string} <br>
{/exp:mp3_info:show}

</p>
</
tr>

{/related_entries}
{
/exp:weblog:entries}

musicdept_song is the related custom field where the actual song information is being stored.  The interesting part is, the ID3tag is retrieved and shown even with the error. 

Anyone tried using this plugin with related fields yet? smile

Profile
 
 
Posted: 04 February 2009 07:40 AM   [ Ignore ]   [ # 16 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006

I’m tempted to say that this warning stems from a glitch in the EE-API. It is however easily to circumvent so you don’t have to wait, while I investigate.

If you re-download the module and replace mod.mp3_info.php the notice goes away.

On a sidenote:

{exp:mp3_info:show file="/musicdept/music/You_Are_Holy.mp3"}

If the file-parameter already contains the full path to the file like in your example you don’t need the path=”“.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 19 January 2010 11:56 AM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  251
Joined  11-16-2004

Can’t wait to get this module working, however I’m can’t seem to get it to spit out anything. Installed it as usual on 1.6.8. Here is my code:

{exp:mp3_info:show file='/media/audio/STE-008.mp3'}
This is a MP3 file
:
version: {mpeg_version_id}
Time
: {playtime_seconds}
Size
: {filesize}
{
/exp:mp3_info:show}

This unfortunately returns nothing.

Here is what I am getting from template debugging:

(0.009784) Parsing Tags in Template
(0.009820) Tag: {exp:mp3_info:show file='&#47;media&#47;audio&#47;STE-008.mp3'}
(0.009946) Closing Tag Found
(0.010006) Processing Tags
(0.010030) Module Tag: Mp3_info/show
(0.010047) Including Files for Tag and Modules
(0.039456) Beginning Final Tag Data Processing
(0.039490) Calling Class/Method: Mp3_info/show
(0.039690) -> Class Called: Mp3_info
(0.039715) -> Method Called: show
(0.040183) -> Data Returned

Any thoughts?

 Signature 

T. Payton
OneCreative | Albuquerque, NM

Profile
 
 
Posted: 19 January 2010 04:20 PM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1886
Joined  10-22-2006
tpayton - 19 January 2010 11:56 AM
media/audio/STE-008.mp3

Is that the absolute path to the file or a relative path?

 Signature 

utilitEEs - Addons for EE

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120401 Total Logged-in Users: 52
Total Topics: 126509 Total Anonymous Users: 17
Total Replies: 665245 Total Guests: 310
Total Posts: 791754    
Members ( View Memberlist )