Author: bnickel
Date: 2007-05-15 03:46:59 -0400 (Tue, 15 May 2007)
New Revision: 77393
Modified:
trunk/taglib-sharp/ChangeLog
trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
trunk/taglib-sharp/src/TagLib/Asf/Tag.cs
trunk/taglib-sharp/src/TagLib/CombinedTag.cs
trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs
trunk/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs
trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs
trunk/taglib-sharp/src/TagLib/Riff/InfoTag.cs
trunk/taglib-sharp/src/TagLib/Tag.cs
Log:
2007-05-15 Brian Nickel <[EMAIL PROTECTED]>
* src/TagLib/Tag.cs:
* src/TagLib/CombinedTag.cs:
* src/TagLib/Riff/InfoTag.cs:
* src/TagLib/Id3v2/Tag.cs
* src/TagLib/Ape/Tag.cs:
* src/TagLib/Asf/Tag.cs:
* src/TagLib/Mpeg4/AppleTag.cs:
* src/TagLib/Mpeg4/BoxTypes.cs:
* src/TagLib/Ogg/XiphComment.cs:
* src/TagLib/Ogg/GroupedComment.cs: Added support for Copyright, BPM,
Composer, and Grouping.
Modified: trunk/taglib-sharp/ChangeLog
===================================================================
--- trunk/taglib-sharp/ChangeLog 2007-05-15 06:48:11 UTC (rev 77392)
+++ trunk/taglib-sharp/ChangeLog 2007-05-15 07:46:59 UTC (rev 77393)
@@ -1,3 +1,17 @@
+2007-05-15 Brian Nickel <[EMAIL PROTECTED]>
+
+ * src/TagLib/Tag.cs:
+ * src/TagLib/CombinedTag.cs:
+ * src/TagLib/Riff/InfoTag.cs:
+ * src/TagLib/Id3v2/Tag.cs
+ * src/TagLib/Ape/Tag.cs:
+ * src/TagLib/Asf/Tag.cs:
+ * src/TagLib/Mpeg4/AppleTag.cs:
+ * src/TagLib/Mpeg4/BoxTypes.cs:
+ * src/TagLib/Ogg/XiphComment.cs:
+ * src/TagLib/Ogg/GroupedComment.cs: Added support for Copyright, BPM,
+ Composer, and Grouping.
+
2007-05-14 Brian Nickel <[EMAIL PROTECTED]>
* src/TagLib/Id3v2/Frames/SynchronizedLyricsFrame.cs: Include TextType
Modified: trunk/taglib-sharp/src/TagLib/Ape/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ape/Tag.cs 2007-05-15 06:48:11 UTC (rev
77392)
+++ trunk/taglib-sharp/src/TagLib/Ape/Tag.cs 2007-05-15 07:46:59 UTC (rev
77393)
@@ -346,6 +346,63 @@
}
}
+ public override string Copyright
+ {
+ get
+ {
+ Item item = GetItem ("COPYRIGHT");
+ return item != null ? item.ToString () : null;
+ }
+ set
+ {
+ AddValue ("COPYRIGHT", value, true);
+ }
+ }
+
+ public override string Conductor
+ {
+ get
+ {
+ Item item = GetItem ("CONDUCTOR");
+ return item != null ? item.ToString () : null;
+ }
+ set
+ {
+ AddValue ("CONDUCTOR", value, true);
+ }
+ }
+
+ public override string Grouping
+ {
+ get
+ {
+ Item item = GetItem ("GROUPING");
+ return item != null ? item.ToString () : null;
+ }
+ set
+ {
+ AddValue ("GROUPING", value, true);
+ }
+ }
+
+ public override uint BPM
+ {
+ get
+ {
+ Item item = GetItem ("TEMPO");
+ uint value;
+
+ if ((item = GetItem ("TEMPO")) != null && uint.TryParse
(item.ToString (), out value))
+ return value;
+
+ return 0;
+ }
+ set
+ {
+ AddNumberValue ("TEMPO", value, 0, true);
+ }
+ }
+
public override bool IsEmpty {get {return items.Count == 0;}}
public Footer Footer {get {return footer;}}
Modified: trunk/taglib-sharp/src/TagLib/Asf/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Asf/Tag.cs 2007-05-15 06:48:11 UTC (rev
77392)
+++ trunk/taglib-sharp/src/TagLib/Asf/Tag.cs 2007-05-15 07:46:59 UTC (rev
77393)
@@ -171,7 +171,8 @@
{
if (value == 0)
RemoveDescriptors ("WM/Year");
- SetDescriptorString (value.ToString (), "WM/Year");
+ else
+ SetDescriptorString (value.ToString (), "WM/Year");
}
}
@@ -189,7 +190,8 @@
{
if (value == 0)
RemoveDescriptors ("WM/TrackNumber");
- SetDescriptors ("WM/TrackNumber", new ContentDescriptor
("WM/TrackNumber", value));
+ else
+ SetDescriptors ("WM/TrackNumber", new ContentDescriptor
("WM/TrackNumber", value));
}
}
@@ -208,7 +210,8 @@
{
if (value == 0)
RemoveDescriptors ("TrackTotal");
- SetDescriptors ("TrackTotal", new ContentDescriptor ("TrackTotal",
value));
+ else
+ SetDescriptors ("TrackTotal", new ContentDescriptor
("TrackTotal", value));
}
}
@@ -285,6 +288,43 @@
set {SetDescriptorString (value, "WM/Lyrics");}
}
+ public override string Copyright
+ {
+ get {return GetDescriptorString ("Copyright");}
+ set {SetDescriptorString (value, "Copyright");}
+ }
+
+ public override string Grouping
+ {
+ get {return GetDescriptorString ("WM/ContentGroupDescription");}
+ set {SetDescriptorString (value, "WM/ContentGroupDescription");}
+ }
+
+ public override string Conductor
+ {
+ get {return GetDescriptorString ("WM/Conductor");}
+ set {SetDescriptorString (value, "WM/Conductor");}
+ }
+
+ public override uint BPM
+ {
+ get
+ {
+ foreach (ContentDescriptor desc in GetDescriptors
("WM/BeatsPerMinute"))
+ if (desc.ToDWord () != 0)
+ return desc.ToDWord ();
+
+ return 0;
+ }
+ set
+ {
+ if (value == 0)
+ RemoveDescriptors ("WM/BeatsPerMinute");
+ else
+ SetDescriptors ("WM/BeatsPerMinute", new ContentDescriptor
("WM/BeatsPerMinute", value));
+ }
+ }
+
public override IPicture [] Pictures
{
get
Modified: trunk/taglib-sharp/src/TagLib/CombinedTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/CombinedTag.cs 2007-05-15 06:48:11 UTC
(rev 77392)
+++ trunk/taglib-sharp/src/TagLib/CombinedTag.cs 2007-05-15 07:46:59 UTC
(rev 77393)
@@ -312,7 +312,79 @@
tag.Lyrics = value;
}
}
-
+
+ public override string Grouping
+ {
+ get
+ {
+ string output = null;
+ foreach (Tag tag in tags)
+ if (tag != null && output == null)
+ output = tag.Grouping;
+ return output;
+ }
+ set
+ {
+ foreach (Tag tag in tags)
+ if (tag != null)
+ tag.Grouping = value;
+ }
+ }
+
+ public override uint BPM
+ {
+ get
+ {
+ uint output = 0;
+ foreach (Tag tag in tags)
+ if (tag != null && output == 0)
+ output = tag.BPM;
+ return output;
+ }
+ set
+ {
+ foreach (Tag tag in tags)
+ if (tag != null)
+ tag.BPM = value;
+ }
+ }
+
+ public override string Copyright
+ {
+ get
+ {
+ string output = null;
+ foreach (Tag tag in tags)
+ if (tag != null && output == null)
+ output = tag.Copyright;
+ return output;
+ }
+ set
+ {
+ foreach (Tag tag in tags)
+ if (tag != null)
+ tag.Copyright = value;
+ }
+ }
+
+ public override string Conductor
+ {
+ get
+ {
+ string output = null;
+ foreach (Tag tag in tags)
+ if (tag != null && output == null)
+ output = tag.Conductor;
+ return output;
+ }
+ set
+ {
+ foreach (Tag tag in tags)
+ if (tag != null)
+ tag.Conductor = value;
+ }
+ }
+
public override IPicture [] Pictures {
get {
foreach(Tag tag in tags) {
Modified: trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs 2007-05-15 06:48:11 UTC (rev
77392)
+++ trunk/taglib-sharp/src/TagLib/Id3v2/Tag.cs 2007-05-15 07:46:59 UTC (rev
77393)
@@ -424,7 +424,6 @@
}
}
-
public override string Lyrics
{
get
@@ -439,6 +438,65 @@
}
}
+ public override uint BPM
+ {
+ get
+ {
+ uint value;
+ foreach (TextIdentificationFrame f in GetFrames("TBPM"))
+ if(uint.TryParse(f.ToString(), out value))
+ return value;
+
+ return 0;
+ }
+ set
+ {
+ SetNumberFrame ("TBPM", BPM, 0);
+ }
+ }
+
+ public override string Grouping
+ {
+ get
+ {
+ foreach (TextIdentificationFrame f in GetFrames ("TIT1"))
+ return f.ToString ();
+ return null;
+ }
+ set
+ {
+ SetTextFrame ("TIT1", value);
+ }
+ }
+
+ public override string Conductor
+ {
+ get
+ {
+ foreach (TextIdentificationFrame f in GetFrames ("TPE3"))
+ return f.ToString ();
+ return null;
+ }
+ set
+ {
+ SetTextFrame("TPE3", value);
+ }
+ }
+
+ public override string Copyright
+ {
+ get
+ {
+ foreach (TextIdentificationFrame f in GetFrames ("TCOP"))
+ return f.ToString ();
+ return null;
+ }
+ set
+ {
+ SetTextFrame("TCOP", value);
+ }
+ }
+
public override bool IsEmpty {get {return frame_list.Count == 0;}}
public Header Header {get {return header;}}
Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs 2007-05-15 06:48:11 UTC
(rev 77392)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/AppleTag.cs 2007-05-15 07:46:59 UTC
(rev 77393)
@@ -211,17 +211,8 @@
public override string [] AlbumArtists
{
- get {return IsCompilation ? new string [] {"Various Artists"} :
Performers;}
- set
- {
- if (value.Length == 1 && value [0].ToLower () == "various artists")
- IsCompilation = true;
- else
- {
- IsCompilation = false;
- Performers = value;
- }
- }
+ get { return GetText(BoxTypes.Aart); }
+ set { SetText(BoxTypes.Aart, value); }
}
public bool IsCompilation
@@ -419,7 +410,66 @@
SetText (BoxTypes.Lyr, value);
}
}
-
+
+ public override uint BPM
+ {
+ get
+ {
+ foreach (AppleDataBox box in DataBoxes (BoxTypes.Tmpo))
+ if (box.Flags == (uint)AppleDataBox.FlagTypes.ForTempo)
+ return box.Data.ToUInt ();
+
+ return 0;
+ }
+ set
+ {
+ SetData (BoxTypes.Tmpo, ByteVector.FromUInt (value),
(uint)AppleDataBox.FlagTypes.ForTempo);
+ }
+ }
+
+ public override string Grouping
+ {
+ get
+ {
+ foreach (AppleDataBox box in DataBoxes(BoxTypes.Grp))
+ return box.Text;
+
+ return null;
+ }
+ set
+ {
+ SetText(BoxTypes.Grp, value);
+ }
+ }
+
+ public override string Conductor
+ {
+ get
+ {
+ foreach (AppleDataBox box in DataBoxes(BoxTypes.Cond))
+ return box.Text;
+ return null;
+ }
+ set
+ {
+ SetText(BoxTypes.Cond, value);
+ }
+ }
+
+ public override string Copyright
+ {
+ get
+ {
+ foreach (AppleDataBox box in DataBoxes(BoxTypes.Cprt))
+ return box.Text;
+ return null;
+ }
+ set
+ {
+ SetText(BoxTypes.Cprt, value);
+ }
+ }
+
public override IPicture [] Pictures
{
get
Modified: trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs 2007-05-15 06:48:11 UTC
(rev 77392)
+++ trunk/taglib-sharp/src/TagLib/Mpeg4/BoxTypes.cs 2007-05-15 07:46:59 UTC
(rev 77393)
@@ -2,12 +2,15 @@
{
public static class BoxTypes
{
+ public static readonly ByteVector Aart = "aART";
public static readonly ByteVector Alb = FixId ("alb");
public static readonly ByteVector Art = FixId ("ART");
public static readonly ByteVector Cmt = FixId ("cmt");
+ public static readonly ByteVector Cond = "cond";
public static readonly ByteVector Covr = "covr";
public static readonly ByteVector Co64 = "co64";
public static readonly ByteVector Cpil = "cpil";
+ public static readonly ByteVector Cprt = "cprt";
public static readonly ByteVector Data = "data";
public static readonly ByteVector Day = FixId ("day");
public static readonly ByteVector Disk = "disk";
@@ -16,6 +19,7 @@
public static readonly ByteVector Free = "free";
public static readonly ByteVector Gen = FixId ("gen");
public static readonly ByteVector Gnre = "gnre";
+ public static readonly ByteVector Grp = FixId("grp");
public static readonly ByteVector Hdlr = "hdlr";
public static readonly ByteVector Lyr = FixId ("lyr");
public static readonly ByteVector Mdia = "mdia";
@@ -30,6 +34,7 @@
public static readonly ByteVector Stbl = "stbl";
public static readonly ByteVector Stco = "stco";
public static readonly ByteVector Stsd = "stsd";
+ public static readonly ByteVector Tmpo = "tmpo";
public static readonly ByteVector Trak = "trak";
public static readonly ByteVector Trkn = "trkn";
public static readonly ByteVector Udta = "udta";
Modified: trunk/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs 2007-05-15 06:48:11 UTC
(rev 77392)
+++ trunk/taglib-sharp/src/TagLib/Ogg/GroupedComment.cs 2007-05-15 07:46:59 UTC
(rev 77393)
@@ -279,6 +279,70 @@
}
}
+ public override string Grouping
+ {
+ get
+ {
+ string output = null;
+ foreach (XiphComment tag in tags)
+ if (tag != null && output == null)
+ output = tag.Grouping;
+ return output;
+ }
+ set
+ {
+ tags [0].Grouping = value;
+ }
+ }
+
+ public override uint BPM
+ {
+ get
+ {
+ uint output = 0;
+ foreach (XiphComment tag in tags)
+ if (tag != null && output == 0)
+ output = tag.BPM;
+ return output;
+ }
+ set
+ {
+ tags [0].BPM = value;
+ }
+ }
+
+ public override string Conductor
+ {
+ get
+ {
+ string output = null;
+ foreach (XiphComment tag in tags)
+ if (tag != null && output == null)
+ output = tag.Conductor;
+ return output;
+ }
+ set
+ {
+ tags [0].Conductor = value;
+ }
+ }
+
+ public override string Copyright
+ {
+ get
+ {
+ string output = null;
+ foreach (XiphComment tag in tags)
+ if (tag != null && output == null)
+ output = tag.Copyright;
+ return output;
+ }
+ set
+ {
+ tags [0].Copyright = value;
+ }
+ }
+
public override IPicture [] Pictures {
get {
foreach(XiphComment tag in tags) {
Modified: trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs 2007-05-15 06:48:11 UTC
(rev 77392)
+++ trunk/taglib-sharp/src/TagLib/Ogg/XiphComment.cs 2007-05-15 07:46:59 UTC
(rev 77393)
@@ -426,8 +426,50 @@
}
}
-
+ public override string Copyright
+ {
+ get
+ {
+ StringList l = GetField ("COPYRIGHT");
+
+ return (l != null && l.Count != 0) ? l [0] : null;
+ }
+ set {AddField ("COPYRIGHT", value);}
+ }
+ public override string Conductor
+ {
+ get
+ {
+ StringList l = GetField ("CONDUCTOR");
+
+ return (l != null && l.Count != 0) ? l [0] : null;
+ }
+ set {AddField ("CONDUCTOR", value);}
+ }
+
+ public override string Grouping
+ {
+ get
+ {
+ StringList l = GetField ("GROUPING");
+
+ return (l != null && l.Count != 0) ? l [0] : null;
+ }
+ set {AddField ("GROUPING", value);}
+ }
+
+ public override uint BPM
+ {
+ get
+ {
+ StringList l = GetField ("TEMPO");
+ uint value;
+ return (l != null && l.Count != 0 && uint.TryParse (l[0], out
value)) ? value : 0;
+ }
+ set {AddNumberField ("TEMPO", value, true);}
+ }
+
//////////////////////////////////////////////////////////////////////////
// protected methods
//////////////////////////////////////////////////////////////////////////
Modified: trunk/taglib-sharp/src/TagLib/Riff/InfoTag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Riff/InfoTag.cs 2007-05-15 06:48:11 UTC
(rev 77392)
+++ trunk/taglib-sharp/src/TagLib/Riff/InfoTag.cs 2007-05-15 07:46:59 UTC
(rev 77393)
@@ -105,5 +105,18 @@
get {return GetValueAsUInt ("IFRM");}
set {SetValue ("IFRM", value);}
}
+
+ public override string Copyright
+ {
+ get
+ {
+ foreach (string s in GetValuesAsStringList ("ICOP"))
+ if (s != null)
+ return s;
+
+ return null;
+ }
+ set {SetValue ("ICOP", value);}
+ }
}
}
\ No newline at end of file
Modified: trunk/taglib-sharp/src/TagLib/Tag.cs
===================================================================
--- trunk/taglib-sharp/src/TagLib/Tag.cs 2007-05-15 06:48:11 UTC (rev
77392)
+++ trunk/taglib-sharp/src/TagLib/Tag.cs 2007-05-15 07:46:59 UTC (rev
77393)
@@ -39,15 +39,19 @@
public virtual uint Disc {get {return 0;} set {}}
public virtual uint DiscCount {get {return 0;} set {}}
public virtual string Lyrics {get {return null;} set {}}
+ public virtual string Grouping {get {return null;} set {}}
+ public virtual uint BPM {get {return 0;} set {}}
+ public virtual string Conductor {get {return null;} set {}}
+ public virtual string Copyright {get {return null;} set {}}
public virtual IPicture [] Pictures { get { return new Picture [] { }; }
set { } }
- public string FirstArtist { get { return FirstInGroup(AlbumArtists);
} }
- public string FirstPerformer { get { return FirstInGroup(Performers); } }
- public string FirstComposer { get { return FirstInGroup(Composers); } }
- public string FirstGenre { get { return FirstInGroup(Genres); } }
+ public string FirstArtist { get { return FirstInGroup(AlbumArtists);}
}
+ public string FirstPerformer { get { return FirstInGroup(Performers); }
}
+ public string FirstComposer { get { return FirstInGroup(Composers); }
}
+ public string FirstGenre { get { return FirstInGroup(Genres); }
}
- public string JoinedArtists { get { return JoinGroup(AlbumArtists);
} }
+ public string JoinedArtists { get { return JoinGroup(AlbumArtists);} }
public string JoinedPerformers { get { return JoinGroup(Performers); }
}
public string JoinedComposers { get { return JoinGroup(Composers); } }
public string JoinedGenres { get { return JoinGroup(Genres); } }
@@ -67,13 +71,17 @@
get
{
return ((Title == null || Title.Trim () == String.Empty) &&
+ (Grouping == null || Grouping.Trim () == String.Empty) &&
(AlbumArtists == null || AlbumArtists.Length == 0) &&
(Performers == null || Performers.Length == 0) &&
(Composers == null || Composers.Length == 0) &&
+ (Conductor == null || Conductor.Trim () == String.Empty) &&
+ (Copyright == null || Copyright.Trim () == String.Empty) &&
(Album == null || Album.Trim () == String.Empty) &&
(Comment == null || Comment.Trim () == String.Empty) &&
(Genres == null || Genres.Length == 0) &&
Year == 0 &&
+ BPM == 0 &&
Track == 0 &&
TrackCount == 0 &&
Disc == 0 &&
@@ -107,6 +115,14 @@
target.Disc = source.Disc;
if (overwrite || target.DiscCount == 0)
target.DiscCount = source.DiscCount;
+ if (overwrite || target.BPM == 0)
+ target.BPM = source.BPM;
+ if (overwrite || target.Grouping == null || target.Grouping.Trim() ==
String.Empty)
+ target.Grouping = source.Grouping;
+ if (overwrite || target.Conductor == null || target.Conductor.Trim()
== String.Empty)
+ target.Conductor = source.Conductor;
+ if (overwrite || target.Copyright == null || target.Copyright.Trim()
== String.Empty)
+ target.Conductor = source.Copyright;
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches