[muine] Bug 572841 – FLAC files are not imported



commit c43fc6c6ca438ff638fbf66ffa1c7759e35fd88f
Author: Priit Laes <plaes plaes org>
Date:   Wed Jul 22 09:08:36 2009 +0300

    Bug 572841 â?? FLAC files are not imported
    
    * src/Metadata.cs: Make metadata parsing more robust.
    Based on patches by Benjamin Bagland and Jorn Baayen.
    
    Signed-off-by: Priit Laes <plaes plaes org>

 ChangeLog       |    7 +++++++
 src/Metadata.cs |   24 +++++++++++++++++++-----
 2 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 91d03fa..a59d6eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-07-22  Priit Laes  <plaes plaes org>
 
+	Bug 572841 â?? FLAC files are not imported
+
+	* src/Metadata.cs: Make metadata parsing more robust.
+	Based on patches by Benjamin Bagland and Jorn Baayen.
+
+2009-07-22  Priit Laes  <plaes plaes org>
+
 	Bug 573172 â?? [PATCH] Get rid of deprecated APIs
 
 	* src/About.cs, src/CoverImage.cs: Fix more deprecation warnings.
diff --git a/src/Metadata.cs b/src/Metadata.cs
index 4ef487f..db0ac6c 100644
--- a/src/Metadata.cs
+++ b/src/Metadata.cs
@@ -76,7 +76,10 @@ namespace Muine
 		public Gdk.Pixbuf AlbumArt {
 			get {
 				if (album_art == null) {
-					TagLib.Id3v2.Tag id3v2_tag = (TagLib.Id3v2.Tag) file.GetTag (TagTypes.Id3v2);
+					TagLib.Id3v2.Tag id3v2_tag = null;
+					try {
+						id3v2_tag = (TagLib.Id3v2.Tag) file.GetTag (TagTypes.Id3v2);
+					} catch {}
 
 					if (id3v2_tag != null) {
 						// Try to get a cover image first.
@@ -96,7 +99,11 @@ namespace Muine
 								return album_art;
 						}
 					}
-					TagLib.Mpeg4.AppleTag apple_tag = (TagLib.Mpeg4.AppleTag) file.GetTag (TagTypes.Apple);
+					TagLib.Mpeg4.AppleTag apple_tag = null;
+					try {
+						apple_tag = (TagLib.Mpeg4.AppleTag) file.GetTag (TagTypes.Apple);
+					} catch {}
+
 					if (apple_tag != null) {
 						foreach (AppleDataBox b in apple_tag.DataBoxes ("covr")) {
 							if (b.Flags == (uint) AppleDataBox.FlagType.ContainsJpegData ||
@@ -165,10 +172,13 @@ namespace Muine
 			get {
 				if (!gain_set)
 				{
+					TagLib.Id3v2.Tag id3v2_tag = null;
 					gain_set = true;
-
 					TagLib.Ogg.XiphComment xiph_comment = (TagLib.Ogg.XiphComment) file.GetTag (TagTypes.Xiph);
-					TagLib.Id3v2.Tag id3v2_tag = (TagLib.Id3v2.Tag) file.GetTag (TagTypes.Id3v2);
+
+					try {
+						id3v2_tag = (TagLib.Id3v2.Tag) file.GetTag (TagTypes.Id3v2);
+					} catch {}
 
 					if (id3v2_tag != null) {
 						foreach (RelativeVolumeFrame f in id3v2_tag.GetFrames ("RVA2")) {
@@ -202,9 +212,13 @@ namespace Muine
 				if (!peak_set)
 				{
 					peak_set = true;
+					TagLib.Id3v2.Tag id3v2_tag = null;
 
 					TagLib.Ogg.XiphComment xiph_comment = (TagLib.Ogg.XiphComment) file.GetTag (TagTypes.Xiph);
-					TagLib.Id3v2.Tag id3v2_tag = (TagLib.Id3v2.Tag) file.GetTag (TagTypes.Id3v2);
+
+					try {
+						id3v2_tag = (TagLib.Id3v2.Tag) file.GetTag (TagTypes.Id3v2);
+					} catch {}
 
 					if (id3v2_tag != null) {
 						foreach (RelativeVolumeFrame f in id3v2_tag.GetFrames ("RVA2")) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]