banshee r3681 - in trunk/banshee: . src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Libraries/MusicBrainz/MusicBrainz
- From: scottp svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3681 - in trunk/banshee: . src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Libraries/MusicBrainz/MusicBrainz
- Date: Sun, 6 Apr 2008 01:02:40 +0100 (BST)
Author: scottp
Date: Sun Apr 6 01:02:39 2008
New Revision: 3681
URL: http://svn.gnome.org/viewvc/banshee?rev=3681&view=rev
Log:
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs:
Got rid of now unnessiary work around and use new Query overload.
* src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Relation.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Label.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Release.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Event.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Disc.cs:
* src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs:
* src/Libraries/MusicBrainz/MusicBrainz/XmlRequestEventArgs.cs:
* src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Utils.cs:
* src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Track.cs:
* src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Query.cs:
* src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzException.cs:
* src/Libraries/MusicBrainz/MusicBrainz/DiscWin32.cs:
* src/Libraries/MusicBrainz/MusicBrainz/Artist.cs:
* src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs: Synced
MusicBrainz# code.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Disc.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Event.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Label.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzException.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Query.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Relation.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Release.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Track.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Utils.cs
trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/XmlRequestEventArgs.cs
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs Sun Apr 6 01:02:39 2008
@@ -99,10 +99,7 @@
OnMetadataQueryStarted (mb_disc);
- ReleaseQueryParameters parameters = new ReleaseQueryParameters ();
- parameters.DiscID = mb_disc.Id;
-
- Query<Release> results = Release.Query (parameters);
+ Query<Release> results = Release.Query (mb_disc);
if (results == null) {
OnMetadataQueryFinished (false);
return;
@@ -124,15 +121,6 @@
int i = 0;
- // FIXME: Ugly hack to work around either a horrid design or a bug
- // in mb-sharp; the track doesn't seem to get loaded from the web
- // service until the properties are accessed on the object. This
- // makes loading the metadata *waaaayyy* slower than it needs to be.
- foreach (Track track in tracks) {
- DevNull (track.Title);
- DevNull (track.Artist.Name);
- }
-
foreach (Track track in tracks) {
// FIXME: Gather more details from MB to save to the DB
this[i].TrackTitle = track.Title;
@@ -144,10 +132,6 @@
OnMetadataQueryFinished (true);
}
- private void DevNull (object o)
- {
- }
-
private void OnMetadataQueryStarted (LocalDisc mb_disc)
{
metadata_query_success = false;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Artist.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Artist.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Artist.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Collections.Generic;
@@ -32,12 +47,27 @@
public ArtistReleaseType (ReleaseStatus status, bool various) : this ((Enum)status, various)
{
}
+
+ public ArtistReleaseType (ReleaseType type, ReleaseStatus status, bool various)
+ {
+ StringBuilder builder = new StringBuilder ();
+ Format (builder, type, various);
+ builder.Append ('+');
+ Format (builder, status, various);
+ str = builder.ToString ();
+ }
ArtistReleaseType (Enum enumeration, bool various)
{
- str = various
- ? "va-" + Utils.EnumToString (enumeration)
- : "sa-" + Utils.EnumToString (enumeration);
+ StringBuilder builder = new StringBuilder ();
+ Format (builder, enumeration, various);
+ str = builder.ToString ();
+ }
+
+ void Format (StringBuilder builder, Enum enumeration, bool various)
+ {
+ builder.Append (various ? "va-" : "sa-");
+ Utils.EnumToString (builder, enumeration.ToString ());
}
public override string ToString ()
@@ -51,23 +81,7 @@
{
const string EXTENSION = "artist";
- protected override string UrlExtension {
- get { return EXTENSION; }
- }
-
- public static ArtistReleaseType DefaultArtistReleaseType =
- new ArtistReleaseType (ReleaseStatus.Official, false);
-
- ArtistReleaseType artist_release_type = DefaultArtistReleaseType;
-
- public ArtistReleaseType ArtistReleaseType {
- get { return artist_release_type; }
- set {
- artist_release_type = value;
- releases = null;
- have_all_releases = false;
- }
- }
+ #region Constructors
Artist (string mbid) : base (mbid, null)
{
@@ -87,21 +101,29 @@
internal Artist (XmlReader reader) : base (reader, false)
{
}
+
+ #endregion
+
+ #region Protected Overrides
+
+ protected override string UrlExtension {
+ get { return EXTENSION; }
+ }
- protected override void HandleCreateInc (StringBuilder builder)
+ protected override void CreateIncCore (StringBuilder builder)
{
AppendIncParameters (builder, artist_release_type.ToString ());
- base.HandleCreateInc (builder);
+ base.CreateIncCore (builder);
}
- protected override void HandleLoadMissingData ()
+ protected override void LoadMissingDataCore ()
{
Artist artist = new Artist (Id, CreateInc ());
type = artist.Type;
- base.HandleLoadMissingData (artist);
+ base.LoadMissingDataCore (artist);
}
- protected override bool HandleAttributes (XmlReader reader)
+ protected override bool ProcessAttributes (XmlReader reader)
{
switch (reader ["type"]) {
case "Group":
@@ -114,10 +136,10 @@
return type != ArtistType.Unknown;
}
- protected override bool HandleXml (XmlReader reader)
+ protected override bool ProcessXml (XmlReader reader)
{
reader.Read ();
- bool result = base.HandleXml (reader);
+ bool result = base.ProcessXml (reader);
if (!result) {
result = true;
switch (reader.Name) {
@@ -138,8 +160,24 @@
reader.Close ();
return result;
}
+
+ #endregion
#region Properties
+
+ public static ArtistReleaseType DefaultArtistReleaseType =
+ new ArtistReleaseType (ReleaseStatus.Official, false);
+
+ ArtistReleaseType artist_release_type = DefaultArtistReleaseType;
+
+ public ArtistReleaseType ArtistReleaseType {
+ get { return artist_release_type; }
+ set {
+ artist_release_type = value;
+ releases = null;
+ have_all_releases = false;
+ }
+ }
[Queryable ("arid")]
public override string Id {
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Disc.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Disc.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Disc.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Disc.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Disc.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Xml;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscLinux.cs Sun Apr 6 01:02:39 2008
@@ -1,12 +1,25 @@
-/***************************************************************************
- * DiscLinux.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
-
-// This is based on $Id: disc_linux.c 8505 2006-09-30 00:02:18Z luks $
+// DiscLinux.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Runtime.InteropServices;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/DiscWin32.cs Sun Apr 6 01:02:39 2008
@@ -1,12 +1,25 @@
-/***************************************************************************
- * DiscWin32.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
-
-// This is based on $Id: disc_win32.c 8506 2006-09-30 19:02:57Z luks $
+// DiscWin32.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Runtime.InteropServices;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Event.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Event.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Event.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Event.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Event.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Xml;
@@ -28,10 +43,10 @@
catalog_number = reader ["catalog-number"];
barcode = reader ["barcode"];
format = Utils.StringToEnum<ReleaseFormat> (reader ["format"]);
- if (reader.ReadToDescendant ("label")) {
- label = new Label (reader.ReadSubtree ());
- reader.Read (); // FIXME this is a workaround for Mono bug 334752
- }
+ if (reader.ReadToDescendant ("label")) {
+ label = new Label (reader.ReadSubtree ());
+ reader.Read (); // FIXME this is a workaround for Mono bug 334752
+ }
reader.Close ();
}
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Label.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Label.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Label.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Label.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Label.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Text;
@@ -42,23 +57,23 @@
{
}
- protected override void HandleLoadMissingData ()
+ protected override void LoadMissingDataCore ()
{
Label label = new Label (Id, CreateInc ());
type = label.Type;
- base.HandleLoadMissingData (label);
+ base.LoadMissingDataCore (label);
}
- protected override bool HandleAttributes (XmlReader reader)
+ protected override bool ProcessAttributes (XmlReader reader)
{
type = Utils.StringToEnum<LabelType> (reader ["type"]);
return this.type != null;
}
- protected override bool HandleXml (XmlReader reader)
+ protected override bool ProcessXml (XmlReader reader)
{
reader.Read ();
- bool result = base.HandleXml (reader);
+ bool result = base.ProcessXml (reader);
if (!result) {
if (reader.Name == "country") {
result = true;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/LocalDisc.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * LocalDisc.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// LocalDisc.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Security.Cryptography;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzEntity.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * MusicBrainzEntity.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// MusicBrainzEntity.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Collections.Generic;
@@ -17,6 +32,9 @@
// A person-like entity, such as an artist or a label.
public abstract class MusicBrainzEntity : MusicBrainzObject
{
+
+ #region Constructors
+
internal MusicBrainzEntity (string mbid, string parameters) : base (mbid, parameters)
{
}
@@ -24,14 +42,18 @@
internal MusicBrainzEntity (XmlReader reader, bool all_rels_loaded) : base (reader, all_rels_loaded)
{
}
+
+ #endregion
+
+ #region Protected Overrides
- protected override void HandleCreateInc (StringBuilder builder)
+ protected override void CreateIncCore (StringBuilder builder)
{
if (aliases == null) AppendIncParameters (builder, "aliases");
- base.HandleCreateInc (builder);
+ base.CreateIncCore (builder);
}
- protected void HandleLoadMissingData (MusicBrainzEntity entity)
+ protected void LoadMissingDataCore (MusicBrainzEntity entity)
{
name = entity.Name;
sort_name = entity.SortName;
@@ -39,10 +61,10 @@
begin_date = entity.BeginDate;
end_date = entity.EndDate;
if (aliases == null) aliases = entity.Aliases;
- base.HandleLoadMissingData (entity);
+ base.LoadMissingDataCore (entity);
}
- protected override bool HandleXml (XmlReader reader)
+ protected override bool ProcessXml (XmlReader reader)
{
bool result = true;
switch (reader.Name) {
@@ -82,8 +104,10 @@
}
return result;
}
+
+ #endregion
- # region Properties
+ #region Properties
string name;
public virtual string Name {
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzException.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzException.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzException.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * MusicBrainzException.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// MusicBrainzException.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzItem.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * MusicBrainzItem.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// MusicBrainzItem.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Text;
@@ -86,6 +101,9 @@
// The item-like product of an artist, such as a track or a release.
public abstract class MusicBrainzItem : MusicBrainzObject
{
+
+ #region Constructors
+
internal MusicBrainzItem (string mbid, string parameters) : base (mbid, parameters)
{
}
@@ -94,21 +112,25 @@
{
if (this.artist == null) this.artist = artist;
}
+
+ #endregion
+
+ #region Protected Overrides
- protected override void HandleCreateInc (StringBuilder builder)
+ protected override void CreateIncCore (StringBuilder builder)
{
if (artist == null) AppendIncParameters(builder, "artist");
- base.HandleCreateInc (builder);
+ base.CreateIncCore (builder);
}
- protected void HandleLoadMissingData (MusicBrainzItem item)
+ protected void LoadMissingDataCore (MusicBrainzItem item)
{
title = item.Title;
if (artist == null) artist = item.Artist;
- base.HandleLoadMissingData (item);
+ base.LoadMissingDataCore (item);
}
- protected override bool HandleXml (XmlReader reader)
+ protected override bool ProcessXml (XmlReader reader)
{
bool result = true;
switch (reader.Name) {
@@ -126,7 +148,11 @@
}
return result;
}
+
+ #endregion
+ #region Properties
+
string title;
public virtual string Title {
get { return GetPropertyOrNull (ref title); }
@@ -137,8 +163,11 @@
public virtual Artist Artist {
get { return GetPropertyOrNull (ref artist); }
}
+
+ #endregion
- public override string ToString () {
+ public override string ToString ()
+ {
return title;
}
}
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzObject.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * MusicBrainzObject.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// MusicBrainzObject.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Collections.Generic;
@@ -54,11 +69,11 @@
protected string CreateInc ()
{
StringBuilder builder = new StringBuilder ();
- HandleCreateInc (builder);
+ CreateIncCore (builder);
return builder.ToString ();
}
- static string [] rels_params = new string [] {
+ static readonly string [] rels_params = new string [] {
"artist-rels",
"release-rels",
"track-rels",
@@ -66,7 +81,7 @@
"url-rels"
};
- protected virtual void HandleCreateInc (StringBuilder builder)
+ protected virtual void CreateIncCore (StringBuilder builder)
{
if (!all_rels_loaded)
AppendIncParameters (builder, rels_params);
@@ -105,14 +120,15 @@
);
}
- protected abstract bool HandleAttributes (XmlReader reader);
- protected abstract bool HandleXml (XmlReader reader);
+ protected abstract bool ProcessAttributes (XmlReader reader);
+ protected abstract bool ProcessXml (XmlReader reader);
+
void CreateFromXml (XmlReader reader)
{
reader.Read ();
id = reader ["id"];
byte.TryParse (reader ["ext:score"], out score);
- HandleAttributes (reader);
+ ProcessAttributes (reader);
while (reader.Read () && reader.NodeType != XmlNodeType.EndElement) {
if (reader.Name == "relation-list") {
all_rels_loaded = true;
@@ -160,21 +176,21 @@
break;
}
} else
- HandleXml (reader.ReadSubtree ());
- }
+ ProcessXml (reader.ReadSubtree ());
+ }
reader.Close ();
- }
+ }
protected void LoadMissingData ()
{
if (!all_data_loaded) {
- HandleLoadMissingData ();
+ LoadMissingDataCore ();
all_data_loaded = true;
}
}
- protected abstract void HandleLoadMissingData ();
- protected void HandleLoadMissingData (MusicBrainzObject obj)
+ protected abstract void LoadMissingDataCore ();
+ protected void LoadMissingDataCore (MusicBrainzObject obj)
{
if (!all_rels_loaded) {
artist_rels = obj.ArtistRelations;
@@ -329,8 +345,7 @@
try {
request.CachePolicy = MusicBrainzService.CachePolicy;
cache_implemented = true;
- } catch (NotImplementedException) {
- }
+ } catch (NotImplementedException) {}
HttpWebResponse response = null;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/MusicBrainzService.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * MusicBrainzService.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// MusicBrainzService.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Net.Cache;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Query.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Query.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Query.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Query.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Query.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Collections;
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Relation.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Relation.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Relation.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Relation.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Relation.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
@@ -16,7 +31,7 @@
Backward
}
- public abstract class RelationPrimative<T>
+ public abstract class RelationBase<T>
{
T target;
string type;
@@ -25,7 +40,7 @@
string begin;
string end;
- internal RelationPrimative (string type, T target, RelationDirection direction,
+ internal RelationBase (string type, T target, RelationDirection direction,
string begin, string end, string[] attributes)
{
this.type = type;
@@ -61,7 +76,7 @@
}
}
- public sealed class Relation<T> : RelationPrimative<T> where T : MusicBrainzObject
+ public sealed class Relation<T> : RelationBase<T> where T : MusicBrainzObject
{
internal Relation (string type,
T target,
@@ -74,7 +89,7 @@
}
}
- public sealed class UrlRelation : RelationPrimative<string>
+ public sealed class UrlRelation : RelationBase<string>
{
internal UrlRelation(string type,
string target,
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Release.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Release.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Release.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Release.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Release.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Collections.Generic;
@@ -14,7 +29,8 @@
namespace MusicBrainz
{
- # region Enums
+
+ #region Enums
public enum ReleaseType
{
@@ -64,7 +80,7 @@
public sealed class ReleaseQueryParameters : ItemQueryParameters
{
string disc_id;
- public string DiscID {
+ public string DiscId {
get { return disc_id; }
set { disc_id = value; }
}
@@ -125,9 +141,7 @@
{
const string EXTENSION = "release";
- protected override string UrlExtension {
- get { return EXTENSION; }
- }
+ #region Constructors
Release (string mbid) : base (mbid, null)
{
@@ -141,9 +155,17 @@
{
}
+ #endregion
+
+ #region Protected Overrides
+
+ protected override string UrlExtension {
+ get { return EXTENSION; }
+ }
+
static readonly string [] track_params = new string [] { "tracks", "track-level-rels", "artist" };
- protected override void HandleCreateInc (StringBuilder builder)
+ protected override void CreateIncCore (StringBuilder builder)
{
AppendIncParameters (builder, "release-events", "labels");
if (discs == null) AppendIncParameters (builder, "discs");
@@ -151,10 +173,10 @@
AppendIncParameters (builder, track_params);
AllRelsLoaded = false;
}
- base.HandleCreateInc (builder);
+ base.CreateIncCore (builder);
}
- protected override void HandleLoadMissingData ()
+ protected override void LoadMissingDataCore ()
{
Release release = new Release (Id, CreateInc ());
type = release.Type;
@@ -165,10 +187,10 @@
events = release.Events;
if (discs == null) discs = release.Discs;
if (tracks == null) tracks = release.Tracks;
- base.HandleLoadMissingData (release);
+ base.LoadMissingDataCore (release);
}
- protected override bool HandleAttributes (XmlReader reader)
+ protected override bool ProcessAttributes (XmlReader reader)
{
// How sure am I about getting the type and status in the "Type Status" format?
// MB really ought to specify these two things seperatly.
@@ -184,10 +206,10 @@
return this.type != null || this.status != null;
}
- protected override bool HandleXml (XmlReader reader)
+ protected override bool ProcessXml (XmlReader reader)
{
reader.Read ();
- bool result = base.HandleXml (reader);
+ bool result = base.ProcessXml (reader);
if (!result) {
result = true;
switch (reader.Name) {
@@ -239,6 +261,8 @@
reader.Close ();
return result;
}
+
+ #endregion
#region Properties
@@ -262,7 +286,6 @@
[Queryable]
public ReleaseStatus Status {
get { return GetPropertyOrDefault (ref status, ReleaseStatus.None); }
-
}
string language;
@@ -333,6 +356,15 @@
parameters.Artist = artist;
return Query (parameters);
}
+
+ public static Query<Release> Query (Disc disc)
+ {
+ if (disc == null) throw new ArgumentNullException ("disc");
+
+ ReleaseQueryParameters parameters = new ReleaseQueryParameters ();
+ parameters.DiscId = disc.Id;
+ return Query (parameters);
+ }
public static Query<Release> Query (ReleaseQueryParameters parameters)
{
@@ -345,7 +377,7 @@
if (device == null) throw new ArgumentNullException ("device");
ReleaseQueryParameters parameters = new ReleaseQueryParameters ();
- parameters.DiscID = LocalDisc.GetFromDevice (device).Id;
+ parameters.DiscId = LocalDisc.GetFromDevice (device).Id;
return Query (parameters);
}
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Track.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Track.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Track.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Track.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Track.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Collections.Generic;
@@ -78,9 +93,7 @@
{
const string EXTENSION = "track";
- protected override string UrlExtension {
- get { return EXTENSION; }
- }
+ #region Constructors
Track (string mbid) : base (mbid, null)
{
@@ -97,32 +110,40 @@
internal Track (XmlReader reader, Artist artist, bool all_rels_loaded) : base (reader, artist, all_rels_loaded)
{
}
+
+ #endregion
- protected override void HandleCreateInc (StringBuilder builder)
+ #region Protected Overrides
+
+ protected override string UrlExtension {
+ get { return EXTENSION; }
+ }
+
+ protected override void CreateIncCore (StringBuilder builder)
{
if (releases == null) AppendIncParameters (builder, "releases");
if (puids == null) AppendIncParameters (builder, "puids");
- base.HandleCreateInc (builder);
+ base.CreateIncCore (builder);
}
- protected override void HandleLoadMissingData ()
+ protected override void LoadMissingDataCore ()
{
Track track = new Track (Id, CreateInc ());
duration = track.Duration;
if (releases == null) releases = track.Releases;
if (puids == null) puids = track.Puids;
- base.HandleLoadMissingData (track);
+ base.LoadMissingDataCore (track);
}
- protected override bool HandleAttributes (XmlReader reader)
+ protected override bool ProcessAttributes (XmlReader reader)
{
return true;
}
- protected override bool HandleXml (XmlReader reader)
+ protected override bool ProcessXml (XmlReader reader)
{
reader.Read ();
- bool result = base.HandleXml (reader);
+ bool result = base.ProcessXml (reader);
if (!result) {
result = true;
switch (reader.Name) {
@@ -156,6 +177,8 @@
reader.Close ();
return result;
}
+
+ #endregion
#region Properties
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Utils.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Utils.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/Utils.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * Utils.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// Utils.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
using System.Text;
@@ -17,13 +32,18 @@
{
string str = enumeration.ToString ();
StringBuilder builder = new StringBuilder (str.Length);
+ EnumToString (builder, str);
+ return builder.ToString ();
+ }
+
+ public static void EnumToString (StringBuilder builder, string str)
+ {
builder.Append (str [0]);
for (int i = 1; i < str.Length; i++) {
if (str [i] >= 'A' && str [i] <= 'Z')
builder.Append ('-');
builder.Append (str [i]);
}
- return builder.ToString ();
}
public static T StringToEnum<T> (string name) where T : struct
Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/XmlRequestEventArgs.cs
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/XmlRequestEventArgs.cs (original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz/XmlRequestEventArgs.cs Sun Apr 6 01:02:39 2008
@@ -1,10 +1,25 @@
-/***************************************************************************
- * XmlRequestEventArgs.cs
- *
- * Authored by Scott Peterson <lunchtimemama gmail com>
- *
- * The author disclaims copyright to this source code.
- ****************************************************************************/
+// XmlRequestEventArgs.cs
+//
+// Copyright (c) 2008 Scott Peterson <lunchtimemama gmail com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
using System;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]