Back to index

eyed3  0.6.18
Classes | Functions | Variables
tag Namespace Reference

Classes

class  TagException
class  TagHeader
class  ExtendedTagHeader
class  Tag
class  GenreException
class  Genre
class  InvalidAudioFormatException
class  TagFile
class  Mp3AudioFile
class  GenreMap
class  LinkedFile

Functions

def isMp3File
def tagToUserTune
def tagToRfc822

Variables

string ID3_V1_COMMENT_DESC = "ID3 v1 Comment"
tuple genres = GenreMap()

Class Documentation

class tag::TagException
error reading tag

Definition at line 32 of file tag.py.

class tag::GenreException
Problem looking up genre

Definition at line 1420 of file tag.py.

class tag::InvalidAudioFormatException
Problems with audio format

Definition at line 1589 of file tag.py.


Function Documentation

def tag.isMp3File (   fileName)

Definition at line 1734 of file tag.py.

01734 
01735 def isMp3File(fileName):
01736     type = eyeD3.utils.guess_mime_type(fileName);
01737     return type == "audio/mpeg";

def tag.tagToRfc822 (   tag)

Definition at line 1976 of file tag.py.

01976 
01977 def tagToRfc822(tag):
01978     if isinstance(tag, Mp3AudioFile):
01979         tag = tag.getTag();
01980     lines = []
01981     def add(name, value):
01982         if value:
01983             lines.append(u'%s: %s\n' % (name, value))
01984     add('Filename', tag.linkedFile.name)
01985     add('Artist', tag.getArtist())
01986     add('Album', tag.getAlbum())
01987     for comment in tag.getComments():
01988         add('Comment', comment.comment)
01989     try:
01990         g = tag.getGenre()
01991         if g:
01992             add('Genre', '%s (%s)' % (g.getName(), g.getId() or 0))
01993     except GenreException:
01994         pass
01995     add('Title', tag.getTitle())
01996     tn, tt = tag.getTrackNum()
01997     add('Track', tn)
01998     add('Year', tag.getYear())
01999     return ''.join(lines)
02000 
02001 
02002 #
02003 # Module level globals.
#
def tag.tagToUserTune (   tag)

Definition at line 1955 of file tag.py.

01955 
01956 def tagToUserTune(tag):
01957     audio_file = None;
01958     if isinstance(tag, Mp3AudioFile):
01959         audio_file = tag;
01960         tag = audio_file.getTag();
01961 
01962     tune =  [u"<tune xmlns='http://jabber.org/protocol/tune'>\n"]
01963     def add(name, value):
01964         if value:
01965             value = escape(value)
01966             tune.append('  <%s>%s</%s>\n' % (name, value, name))
01967   
01968     add('artist', tag.getArtist())
01969     add('title', tag.getTitle())
01970     add('source', tag.getAlbum())
01971     add('track', "file://" + unicode(os.path.abspath(tag.linkedFile.name)))
01972     if audio_file:
01973         add('length', unicode(audio_file.getPlayTime()))
01974     tune.append("</tune>\n")
01975     return ''.join(tune)


Variable Documentation

tuple tag.genres = GenreMap()

Definition at line 2004 of file tag.py.

string tag.ID3_V1_COMMENT_DESC = "ID3 v1 Comment"

Definition at line 29 of file tag.py.