Dashboard > blojsom > ... > Available Plugins > MP3 Metadata Plugin
  blojsom Log In   View a printable version of the current page.  
  MP3 Metadata Plugin
Added by David Czarnecki, last edited by David Czarnecki on Sep 27, 2005  (view change)
Labels: 
(None)

Availability

The MP3-metadata plugin can be downloaded from the blojsom plugins download page.

This plugin works with blojsom 2.22 and earlier!

Description

The MP3-metadata plugin enables the embedding of mp3 file and id3 data for mp3 and m3u rss enclosures inside blog entries. Entries can directly refer to file metadata such as file size, time, artist, tranck name, track number, genre, etc. This plugin will likely be most useful to people who are distributing audio files with RSS enclosures; it's designed to work in conjunction with, and as a complement to, the RSS Enclosure plugin.

Installation and Setup

Add the mp3-metadata.jar to blojsom's /WEB-INF/lib directory.

In your global /WEB-INF/plugin.properties file, add the following line:

mp3-metadata=org.blojsom.plugin.file.MP3Info

Add the "mp3-metadata" plugin to the plugin chain for all the flavors with which you'd like to use it. (The most likely candidate is the html flavor, and possibly syndication flavors as well) The MP3-metadata plugin is dependent on the meta plugin, and the meta plugin must be in any applicable plugin chains before mp3-metadata.

html.blojsom-plugin-chain=meta,...,mp3-metadata,...

Make sure that you have a recent version of Perl, and that it's in your path.

Make sure that you have a recent version of the MP3::Info perl module installed. (Install using the perl -eshell -MCPAN on Unix-like platforms, or using PPM on Windows.

Usage and URL Parameters

Usage

The MP3-metadata plugin will retrieve data for a file associated with a blog entry. You associate a file with a blog entry by:

  • Upload a file to the blog, using the admin console.
  • Add meta-rss-enclosure metadata line to your blog entry with the name of the uploaded file, like this:

    meta-rss-enclosure=your-uploaded-file.mp3

MP3-metadata works with files attached following the conventions of the RSS Enclosure plugin, so you should look at it's documentation as well. It will also work with m3u files, with the following constraints:

  • The mp3 file referenced by the m3u file must have been uploaded to Blojsom.
  • Metadata for the referenced mp3 file may be acquirable if the file is resident inside another web application on the same server that's hosting your Blojsom server (but no guarantees).
  • Blojsom (or the other webapp, if it's hosted in another webapp) must not be running as the root application of the webapp server. (Typically, blojsom won't be running as the root application, so this shouldn't be a problem, and it's not a problem for plain mp3 enclosures)
  • The metadata returned for an m3u file will actually be the metadata for the referenced mp3 file except for the url field, which will reference the m3u file itself.

Displaying Audio File Properties

You can display information about the mp3 file in your entries by modifying your templates to display metadata from the metadata key rss-enclosure-metadata.

To display the title of an mp3 file:

$!entry.metaData.rss-enclosure-metadata.title

or, using function syntax:

$!entry.getMetaData().get("rss-enclosure-metadata").getTitle()

as a link to the file, and show the total running time of the file, include the following snippet in your template:

<a href="$!entry.metaData.rss-enclosure-metadata.url">$!entry.metaData.rss-enclosure-metadata.title</a> Time: $!entry.metaData.rss-enclosure-metadata.time

List of available properties

  • album
    The 'album' from the id3 tag
  • artist
    The 'artist' from the id3 tag
  • bitrate
    The file's bitrate, in kilobits/seconds (kbps)
  • channelMode
    The number of audio channels, as text
  • channels
    The number of audio channels (mono = 1, stereo = 2)
  • bpm
    Beats Per Minute, from the id3 tag
  • comment
    Comment, from the id3 tag
  • isCopyrighted
    true or false, from the id3 tag
  • disk
    From the id3 tag
  • fileName
    The name of the file, without path information
  • framecount
    The number of frames in the mp3 file
  • genre
    From the id3 tag
  • layer
    The MPEG layer
  • length
    The length of the file, in seconds
  • license
    License info, from the id3 tag
  • lyrics
    From the id3 tag
  • mimeType
    The file's mime type (mp3 files are audio/x-mpeg)
  • modificationDate
    The date the file was last changed
  • sampleRate
    The file's sampling frequency
  • size
    Size of the file, in bytes
  • technicalString
    Technical data about the file
  • time
    The length of the track, in HH:MM:SS format, or MM::SS if less than one hour
  • totalDisks
    The number of disks in a multi-disk set, from the id3 tag
  • totalTracks
    Total number of tracks on the disk this track is from
  • track
    The track number of this track
  • url
    The URL for this file
  • volumeAdjustment
    Volume adjustment hint, from the id3 tag
  • year
    From the id3 tag

Issues

  • Best results may be obtained when your mp3/m3u files have version 1.0 or 2.3.0 ID3 tags.
  • It's possible to use the plugin with non-mp3 files, but only the fileName/url/size/modificationDate properties will be available.
  • Perl must be in your path, and the MP3::Info module must be installed

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators