1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
<?xml version="1.0" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>mp3tag.rb</title>
</head>
<body>
<h1><a name="label:0" id="label:0">Synopsis</a></h1><!-- RDLabel: "Synopsis" -->
<p>Read the tag from a file or create and Mp3Tag instance for saving tag to
mp3 file later:</p>
<pre>tag = Mp3Tag.new(filename)</pre>
<p>Examining tags:</p>
<pre>tag.songname
tag.artist
tag.album
tag.year
tag.comment
tag.tracknum
tag.genre_id
tag.genre</pre>
<p>Setting tags:</p>
<pre>tag.songname = "My Song"
tag.artist = "Me"
tag.album = "My Album"
tag.year = "2001"
tag.comment = "No Comment"
tag.tracknum = 3
tag.genre_id = 23
tag.genre = "Drum Solo"</pre>
<p>genre_id's should exist in Mp3Tag::Genres. Elements in Mp3Tag::Genres
can be assigned using tag.genre= and the id will be looked up
automatically.</p>
<p>Saving tag to mp3:</p>
<pre>tag.commit</pre>
<p>Checking if a file has a tag:</p>
<pre>Mp3Tag.hastag?(filename)</pre>
<h1><a name="label:1" id="label:1">Class Methods</a></h1><!-- RDLabel: "Class Methods" -->
<dl>
<dt><a name="label:2" id="label:2"><code>Mp3Tag.new(<var>path</var>)</code></a></dt><!-- RDLabel: "Mp3Tag.new" -->
<dd>
<p>Creates a new Mp3Tag object for the file give by <var>path</var>.</p></dd>
</dl>
<dl>
<dt><a name="label:3" id="label:3"><code>Mp3Tag.hastag?(<var>filename</var>)</code></a></dt><!-- RDLabel: "Mp3Tag.hastag?" -->
<dd>
<p>Tests if <var>filename</var> has a ID3V1.0 or ID3V1.1 tag. Returns a boolean values giving the result of the test.</p></dd>
</dl>
<dl>
<dt><a name="label:4" id="label:4"><code>Mp3Tag.removetag(<var>filename</var>)</code></a></dt><!-- RDLabel: "Mp3Tag.removetag" -->
<dd>
<p>Removes an ID3v1 tag from the MP3 file <var>filename</var></p></dd>
</dl>
<h1><a name="label:5" id="label:5">Instance Methods</a></h1><!-- RDLabel: "Instance Methods" -->
<dl>
<dt><a name="label:6" id="label:6"><code>songname</code></a><!-- RDLabel: "songname" -->
<dt><a name="label:7" id="label:7"><code>artist</code></a><!-- RDLabel: "artist" -->
<dt><a name="label:8" id="label:8"><code>album</code></a><!-- RDLabel: "album" -->
<dt><a name="label:9" id="label:9"><code>comment</code></a></dt><!-- RDLabel: "comment" -->
<dd>
<p>Return the song name, artist, album, or comment from the tag as a String object. Will return empty strings if file did not have a tag.</p></dd>
<dt><a name="label:10" id="label:10"><code>tracknum</code></a></dt><!-- RDLabel: "tracknum" -->
<dd>
<p>Returns the track number from the tag. Will return 0 if the track number was not set in the tag when loaded, or if the file had no tag.</p></dd>
<dt><a name="label:11" id="label:11"><code>year</code></a></dt><!-- RDLabel: "year" -->
<dd>
<p>Returns the year from the tag. Will return 0 if the file had no tag.</p></dd>
<dt><a name="label:12" id="label:12"><code>genre_id</code></a></dt><!-- RDLabel: "genre_id" -->
<dd>
<p>Return the id number of the genre from the tag. Will return 255 if the file had no tag.</p></dd>
<dt><a name="label:13" id="label:13"><code>genre</code></a></dt><!-- RDLabel: "genre" -->
<dd>
<p>Returns the genre name. Will return "Unknown" if the file had no tag or the genre id was not in Mp3Tag::Genres</p></dd>
<dt><a name="label:14" id="label:14"><code>path</code></a></dt><!-- RDLabel: "path" -->
<dd>
<p>Returns the full path name of the MP3 file.</p></dd>
<dt><a name="label:15" id="label:15"><code>filename</code></a></dt><!-- RDLabel: "filename" -->
<dd>
<p>Returns the filename without the directory part of the MP3 File.</p></dd>
<dt><a name="label:16" id="label:16"><code>songname=(<var>txt</var>)</code></a><!-- RDLabel: "songname=" -->
<dt><a name="label:17" id="label:17"><code>artist=(<var>txt</var>)</code></a><!-- RDLabel: "artist=" -->
<dt><a name="label:18" id="label:18"><code>album=(<var>txt</var>)</code></a><!-- RDLabel: "album=" -->
<dt><a name="label:19" id="label:19"><code>comment=(<var>txt</var>)</code></a></dt><!-- RDLabel: "comment=" -->
<dd>
<p>Sets the song name, atist, album, or comment for the tag to <var>txt</var>. <var>txt</var> should be a String object.</p></dd>
<dt><a name="label:20" id="label:20"><code>tracknum=(<var>num</var>)</code></a></dt><!-- RDLabel: "tracknum=" -->
<dd>
<p>Sets the track number for the tag. Only values in the range (0..255) are allowed.</p></dd>
<dt><a name="label:21" id="label:21"><code>year=(<var>num</var>)</code></a></dt><!-- RDLabel: "year=" -->
<dd>
<p>Sets the year for the tag. Should be a four digit number.</p></dd>
<dt><a name="label:22" id="label:22"><code>genre_id=(<var>num</var>)</code></a></dt><!-- RDLabel: "genre_id=" -->
<dd>
<p>Sets the the genre id for the tag. Only values in the range (0..255) are allowed.</p></dd>
<dt><a name="label:23" id="label:23"><code>genre=(<var>txt</var>)</code></a></dt><!-- RDLabel: "genre=" -->
<dd>
<p>Sets the genre id for the tag to the index of <var>txt</var> in Mp3Tag::Genres. The genre id will be set to 255 if <var>txt</var> is not found in the list.</p></dd>
</dl>
<dl>
<dt><a name="label:24" id="label:24"><code>commit</code></a></dt><!-- RDLabel: "commit" -->
<dd>
<p>Saves the tag to the MP3 file. Will overwrite any existing tag.</p></dd>
</dl>
</body>
</html>
|