Author: bnickel
Date: 2006-10-20 18:08:05 -0400 (Fri, 20 Oct 2006)
New Revision: 66851
Modified:
trunk/taglib-sharp/ChangeLog
trunk/taglib-sharp/examples/ReadFromUri.cs
trunk/taglib-sharp/src/TagLib/File.cs
trunk/taglib-sharp/src/TagLib/Mpeg/Header.cs
Log:
2006-10-20 Brian Nickel <[EMAIL PROTECTED]>
* src/TagLib/File.cs: Include the name of the file throwing the
exception
in LocalFileAbstraction.
* src/TagLib/Mpeg/Header.cs: Make frame length logic match Lame (from
TagLib Devel List).
* examples/ReadFromUri.cs: Read multiple files.
Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog 2006-10-20 22:07:16 UTC (rev 66850)
+++ trunk/taglib-sharp/ChangeLog 2006-10-20 22:08:05 UTC (rev 66851)
@@ -1,3 +1,11 @@
+2006-10-20 Brian Nickel <[EMAIL PROTECTED]>
+
+ * src/TagLib/File.cs: Include the name of the file throwing the
exception
+ in LocalFileAbstraction.
+ * src/TagLib/Mpeg/Header.cs: Make frame length logic match Lame (from
+ TagLib Devel List).
+ * examples/ReadFromUri.cs: Read multiple files.
+
2006-10-12 Brian Nickel <[EMAIL PROTECTED]>
* src/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs:
Modified: trunk/taglib-sharp/examples/ReadFromUri.cs
===================================================================
--- trunk/taglib-sharp/examples/ReadFromUri.cs 2006-10-20 22:07:16 UTC (rev
66850)
+++ trunk/taglib-sharp/examples/ReadFromUri.cs 2006-10-20 22:08:05 UTC (rev
66851)
@@ -7,55 +7,58 @@
public static void Main(string [] args)
{
if(args.Length == 0) {
- Console.Error.WriteLine("USAGE: mono ReadFromUri.exe PATH");
+ Console.Error.WriteLine("USAGE: mono ReadFromUri.exe PATH [...]");
return;
}
- string uri = args[0];
-
- try {
- System.IO.FileInfo file_info = new System.IO.FileInfo(uri);
- uri = file_info.FullName;
- } catch {
- }
-
Gnome.Vfs.Vfs.Initialize();
TagLib.File.SetFileAbstractionCreator(new
TagLib.File.FileAbstractionCreator(
VfsFileAbstraction.CreateFile));
try {
- TagLib.File file = TagLib.File.Create(uri);
-
- Console.WriteLine("Title: " + file.Tag.Title);
- Console.WriteLine("Artists: " + (file.Tag.Artists == null ?
"" : System.String.Join ("\n ", file.Tag.Artists)));
- Console.WriteLine("Performers: " + (file.Tag.Performers == null ?
"" : System.String.Join ("\n ", file.Tag.Performers)));
- Console.WriteLine("Composers: " + (file.Tag.Composers == null ?
"" : System.String.Join ("\n ", file.Tag.Composers)));
- Console.WriteLine("Album: " + file.Tag.Album);
- Console.WriteLine("Comment: " + file.Tag.Comment);
- Console.WriteLine("Genres: " + (file.Tag.Genres == null ?
"" : System.String.Join ("\n ", file.Tag.Genres)));
- Console.WriteLine("Year: " + file.Tag.Year);
- Console.WriteLine("Track: " + file.Tag.Track);
- Console.WriteLine("TrackCount: " + file.Tag.TrackCount);
- Console.WriteLine("Disc: " + file.Tag.Disc);
- Console.WriteLine("DiscCount: " + file.Tag.DiscCount + "\n");
-
- Console.WriteLine("Length: " + file.AudioProperties.Duration);
- Console.WriteLine("Bitrate: " + file.AudioProperties.Bitrate);
- Console.WriteLine("SampleRate: " +
file.AudioProperties.SampleRate);
- Console.WriteLine("Channels: " + file.AudioProperties.Channels +
"\n");
+ foreach (string path in args)
+ {
+ string uri = path;
- IPicture [] pictures = file.Tag.Pictures;
-
- Console.WriteLine("Embedded Pictures: " + pictures.Length);
-
- foreach(IPicture picture in pictures) {
- Console.WriteLine(picture.Description);
- Console.WriteLine(" MimeType: " + picture.MimeType);
- Console.WriteLine(" Size: " + picture.Data.Count);
- Console.WriteLine(" Type: " + picture.Type);
+ try {
+ System.IO.FileInfo file_info = new System.IO.FileInfo(uri);
+ uri = file_info.FullName;
+ } catch {
+ }
+
+ TagLib.File file = TagLib.File.Create(uri);
+
+ Console.WriteLine("Title: " + file.Tag.Title);
+ Console.WriteLine("Artists: " + (file.Tag.Artists ==
null ? "" : System.String.Join ("\n ", file.Tag.Artists)));
+ Console.WriteLine("Performers: " + (file.Tag.Performers ==
null ? "" : System.String.Join ("\n ", file.Tag.Performers)));
+ Console.WriteLine("Composers: " + (file.Tag.Composers ==
null ? "" : System.String.Join ("\n ", file.Tag.Composers)));
+ Console.WriteLine("Album: " + file.Tag.Album);
+ Console.WriteLine("Comment: " + file.Tag.Comment);
+ Console.WriteLine("Genres: " + (file.Tag.Genres ==
null ? "" : System.String.Join ("\n ", file.Tag.Genres)));
+ Console.WriteLine("Year: " + file.Tag.Year);
+ Console.WriteLine("Track: " + file.Tag.Track);
+ Console.WriteLine("TrackCount: " + file.Tag.TrackCount);
+ Console.WriteLine("Disc: " + file.Tag.Disc);
+ Console.WriteLine("DiscCount: " + file.Tag.DiscCount + "\n");
+
+ Console.WriteLine("Length: " +
file.AudioProperties.Duration);
+ Console.WriteLine("Bitrate: " +
file.AudioProperties.Bitrate);
+ Console.WriteLine("SampleRate: " +
file.AudioProperties.SampleRate);
+ Console.WriteLine("Channels: " +
file.AudioProperties.Channels + "\n");
+
+ IPicture [] pictures = file.Tag.Pictures;
+
+ Console.WriteLine("Embedded Pictures: " + pictures.Length);
+
+ foreach(IPicture picture in pictures) {
+ Console.WriteLine(picture.Description);
+ Console.WriteLine(" MimeType: " + picture.MimeType);
+ Console.WriteLine(" Size: " + picture.Data.Count);
+ Console.WriteLine(" Type: " + picture.Type);
+ }
+
}
-
} finally {
Gnome.Vfs.Vfs.Shutdown();
}
@@ -74,7 +77,7 @@
FileInfoOptions.GetAccessRights)).Permissions;
if(!IsReadable) {
- throw new System.IO.IOException("File is not readable.");
+ throw new System.IO.IOException("File \"" + name + "\" is not
readable.");
}
}
Modified: trunk/taglib-sharp/src/TagLib/File.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/File.cs 2006-10-20 22:07:16 UTC (rev
66850)
+++ trunk/taglib-sharp/src/TagLib/File.cs 2006-10-20 22:08:05 UTC (rev
66851)
@@ -625,7 +625,7 @@
{
name = file;
if (!IsReadable)
- throw new System.Exception ("File is not readable.");
+ throw new System.Exception ("File \"" + file + "\" is not
readable.");
}
public string Name {get {return name;}}
Modified: trunk/taglib-sharp/src/TagLib/Mpeg/Header.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg/Header.cs 2006-10-20 22:07:16 UTC
(rev 66850)
+++ trunk/taglib-sharp/src/TagLib/Mpeg/Header.cs 2006-10-20 22:08:05 UTC
(rev 66851)
@@ -205,8 +205,10 @@
// Calculate the frame length
if(layer == 1)
frame_length = 24000 * 2 * bitrate / sample_rate + (IsPadded ? 1 :
0);
+ else if (layer == 3)
+ frame_length = 144000 * bitrate / sample_rate + (IsPadded ? 1 : 0);
else
- frame_length = 72000 * bitrate / sample_rate + (IsPadded ? 1 : 0);
+ frame_length = 144000 * bitrate / sample_rate / (version ==
Version.Version1 ? 1 : 2) + (IsPadded ? 1 : 0);
// Now that we're done parsing, set this to be a valid frame.
is_valid = true;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches