banshee r4399 - in trunk/banshee: . src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Core/Banshee.Base/Tests src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Core/Banshee.Streaming src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Extensions/Banshee.AudioCd/Banshee.AudioCd
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4399 - in trunk/banshee: . src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Core/Banshee.Base/Tests src/Core/Banshee.Core/Banshee.Collection src/Core/Banshee.Core/Banshee.Streaming src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Extensions/Banshee.AudioCd/Banshee.AudioCd
- Date: Tue, 19 Aug 2008 19:05:47 +0000 (UTC)
Author: gburt
Date: Tue Aug 19 19:05:46 2008
New Revision: 4399
URL: http://svn.gnome.org/viewvc/banshee?rev=4399&view=rev
Log:
2008-08-19 Gabriel Burt <gabriel burt gmail com>
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs:
* src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistInfo.cs:
* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
* src/Core/Banshee.Core/Banshee.Collection/AlbumInfo.cs:
* src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs:
* src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs:
* src/Core/Banshee.Core/Banshee.Streaming/SaveTrackMetadataJob.cs:
* src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs:
* src/Core/Banshee.Core/Banshee.Streaming/CommonTags.cs:
* src/Core/Banshee.Core/Banshee.Base/Tests/TaglibReadWriteTests.cs:
* src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs: Read BPM,
Grouping, Bitrate, Conductor, DiscCount, and IsCompilation from TagLib#,
and write the values that make sense (all but Bitrate). This update
triggers a metadata refresh to read in this info.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/TaglibReadWriteTests.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/AlbumInfo.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/CommonTags.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/SaveTrackMetadataJob.cs
trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs (original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs Tue Aug 19 19:05:46 2008
@@ -57,7 +57,8 @@
AddTag (CommonTags.TrackNumber, (uint)track.TrackNumber);
AddTag (CommonTags.TrackCount, (uint)track.TrackCount);
- AddTag (CommonTags.AlbumVolumeNumber, (uint)track.Disc);
+ AddTag (CommonTags.AlbumDiscNumber, (uint)track.DiscNumber);
+ AddTag (CommonTags.AlbumDiscCount, (uint)track.DiscCount);
AddYear (track.Year);
AddDate (track.ReleaseDate);
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/TaglibReadWriteTests.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/TaglibReadWriteTests.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Base/Tests/TaglibReadWriteTests.cs Tue Aug 19 19:05:46 2008
@@ -114,7 +114,7 @@
track.AlbumTitle = "My Album";
track.Genre = genre;
track.TrackNumber = 4;
- track.Disc = 4;
+ track.DiscNumber = 4;
track.Year = 1999;
// Save changes
@@ -131,7 +131,7 @@
Assert.AreEqual ("My Album", track.AlbumTitle);
Assert.AreEqual (genre, track.Genre);
Assert.AreEqual (4, track.TrackNumber);
- Assert.AreEqual (4, track.Disc);
+ Assert.AreEqual (4, track.DiscNumber);
Assert.AreEqual (1999, track.Year);
}
@@ -149,4 +149,4 @@
}
}
-#endif
\ No newline at end of file
+#endif
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/AlbumInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/AlbumInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/AlbumInfo.cs Tue Aug 19 19:05:46 2008
@@ -37,6 +37,7 @@
{
private string title;
private string artist_name;
+ private bool is_compilation;
private string artwork_id;
private DateTime release_date = DateTime.MinValue;
private string musicbrainz_id;
@@ -60,6 +61,11 @@
set { title = value; }
}
+ public virtual bool IsCompilation {
+ get { return is_compilation; }
+ set { is_compilation = value; }
+ }
+
public virtual string MusicBrainzId {
get { return musicbrainz_id; }
set { musicbrainz_id = value; }
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/FileTrackInfo.cs Tue Aug 19 19:05:46 2008
@@ -54,7 +54,7 @@
AlbumTitle = Choose (file.Tag.Album, AlbumTitle);
TrackTitle = Choose (file.Tag.Title, TrackTitle);
Genre = Choose (file.Tag.FirstGenre, Genre);
- Disc = file.Tag.Disc == 0 ? (int)Disc : (int)file.Tag.Disc;
+ DiscNumber = file.Tag.Disc == 0 ? (int)DiscNumber : (int)file.Tag.Disc;
TrackNumber = file.Tag.Track == 0 ? (int)TrackNumber : (int)file.Tag.Track;
TrackCount = file.Tag.TrackCount == 0 ? (int)TrackCount : (int)file.Tag.TrackCount;
Duration = file.Properties.Duration;
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs Tue Aug 19 19:05:46 2008
@@ -51,9 +51,12 @@
private string artist_name;
private string album_title;
private string album_artist;
+ private bool is_compilation;
private string track_title;
private string genre;
private string composer;
+ private string conductor;
+ private string grouping;
private string copyright;
private string license_uri;
private string musicbrainz_id;
@@ -61,9 +64,12 @@
private string comment;
private int track_number;
private int track_count;
- private int disc;
+ private int disc_number;
+ private int disc_count;
private int year;
private int rating;
+ private int bpm;
+ private int bit_rate;
private TimeSpan duration;
private DateTime release_date;
@@ -155,9 +161,14 @@
}
public virtual string AlbumArtist {
- get { return album_artist ?? ArtistName; }
+ get { return album_artist ?? (IsCompilation ? Catalog.GetString ("Various Artists") : ArtistName); }
set { album_artist = value; }
}
+
+ public virtual bool IsCompilation {
+ get { return is_compilation; }
+ set { is_compilation = value; }
+ }
public virtual string TrackTitle {
get { return track_title; }
@@ -238,9 +249,14 @@
set { track_count = value; }
}
- public virtual int Disc {
- get { return disc; }
- set { disc = value; }
+ public virtual int DiscNumber {
+ get { return disc_number; }
+ set { disc_number = value; }
+ }
+
+ public virtual int DiscCount {
+ get { return disc_count; }
+ set { disc_count = value; }
}
public virtual int Year {
@@ -253,6 +269,16 @@
set { composer = value; }
}
+ public virtual string Conductor {
+ get { return conductor; }
+ set { conductor = value; }
+ }
+
+ public virtual string Grouping {
+ get { return grouping; }
+ set { grouping = value; }
+ }
+
public virtual string Copyright {
get { return copyright; }
set { copyright = value; }
@@ -272,6 +298,16 @@
get { return rating; }
set { rating = value; }
}
+
+ public virtual int Bpm {
+ get { return bpm; }
+ set { bpm = value; }
+ }
+
+ public virtual int BitRate {
+ get { return bit_rate; }
+ set { bit_rate = value; }
+ }
public virtual int PlayCount {
get { return play_count; }
@@ -364,7 +400,7 @@
// Our own
dict.Add ("track-number", TrackNumber);
dict.Add ("track-count", TrackCount);
- dict.Add ("disc", Disc);
+ dict.Add ("disc", DiscNumber);
dict.Add ("year", year);
dict.Add ("rating", rating);
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/CommonTags.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/CommonTags.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/CommonTags.cs Tue Aug 19 19:05:46 2008
@@ -42,8 +42,8 @@
public const string Composer = "composer";
public const string TrackNumber = "track-number";
public const string TrackCount = "track-count";
- public const string AlbumVolumeNumber = "album-disc-number";
- public const string AlbumVolumeCount = "album-disc-count";
+ public const string AlbumDiscNumber = "album-disc-number";
+ public const string AlbumDiscCount = "album-disc-count";
public const string Location = "location";
public const string Description = "description";
public const string Version = "version";
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/SaveTrackMetadataJob.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/SaveTrackMetadataJob.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/SaveTrackMetadataJob.cs Tue Aug 19 19:05:46 2008
@@ -74,11 +74,32 @@
file.Tag.Track = (uint)track.TrackNumber;
file.Tag.TrackCount = (uint)track.TrackCount;
file.Tag.Composers = new string [] { track.Composer };
+ file.Tag.Conductor = track.Conductor;
+ file.Tag.Grouping = track.Grouping;
file.Tag.Copyright = track.Copyright;
file.Tag.Comment = track.Comment;
- file.Tag.Disc = (uint)track.Disc;
+ file.Tag.Disc = (uint)track.DiscNumber;
+ file.Tag.DiscCount = (uint)track.DiscCount;
file.Tag.Year = (uint)track.Year;
+ file.Tag.BeatsPerMinute = (uint)track.Bpm;
+
+ SaveIsCompilation (file.Tag, track.IsCompilation);
file.Save ();
}
+
+ private static void SaveIsCompilation (TagLib.Tag tag, bool is_compilation)
+ {
+ TagLib.Id3v2.Tag id3v2_tag = tag as TagLib.Id3v2.Tag;
+ if (id3v2_tag != null) {
+ id3v2_tag.IsCompilation = is_compilation;
+ return;
+ }
+
+ TagLib.Mpeg4.AppleTag apple_tag = tag as TagLib.Mpeg4.AppleTag;
+ if (apple_tag != null) {
+ apple_tag.IsCompilation = is_compilation;
+ return;
+ }
+ }
}
}
Modified: trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs (original)
+++ trunk/banshee/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs Tue Aug 19 19:05:46 2008
@@ -105,10 +105,14 @@
public static void TrackInfoMerge (TrackInfo track, TagLib.File file, bool preferTrackInfo)
{
+ // TODO support these as arrays:
+ // Performers[] (track artists), AlbumArtists[], Composers[], Genres[]
+
// Note: this should be kept in sync with the metadata written in SaveTrackMetadataJob.cs
track.Uri = new SafeUri (file.Name);
track.MimeType = file.MimeType;
track.FileSize = Banshee.IO.File.GetSize (track.Uri);
+ track.BitRate = file.Properties.AudioBitrate;
track.Duration = file.Properties.Duration;
FindTrackMediaAttributes (track, file);
@@ -116,16 +120,22 @@
track.ArtistName = Choose (file.Tag.JoinedPerformers, track.ArtistName, preferTrackInfo);
track.AlbumTitle = Choose (file.Tag.Album, track.AlbumTitle, preferTrackInfo);
track.AlbumArtist = Choose (file.Tag.FirstAlbumArtist, track.AlbumArtist, preferTrackInfo);
+ track.IsCompilation = IsCompilation (file.Tag);
+
track.TrackTitle = Choose (file.Tag.Title, track.TrackTitle, preferTrackInfo);
track.Genre = Choose (file.Tag.FirstGenre, track.Genre, preferTrackInfo);
track.Composer = Choose (file.Tag.FirstComposer, track.Composer, preferTrackInfo);
+ track.Conductor = Choose (file.Tag.Conductor, track.Conductor, preferTrackInfo);
+ track.Grouping = Choose (file.Tag.Grouping, track.Grouping, preferTrackInfo);
track.Copyright = Choose (file.Tag.Copyright, track.Copyright, preferTrackInfo);
track.Comment = Choose (file.Tag.Comment, track.Comment, preferTrackInfo);
track.TrackNumber = Choose ((int)file.Tag.Track, track.TrackNumber, preferTrackInfo);
track.TrackCount = Choose ((int)file.Tag.TrackCount, track.TrackCount, preferTrackInfo);
- track.Disc = Choose ((int)file.Tag.Disc, track.Disc, preferTrackInfo);
+ track.DiscNumber = Choose ((int)file.Tag.Disc, track.DiscNumber, preferTrackInfo);
+ track.DiscCount = Choose ((int)file.Tag.DiscCount, track.DiscCount, preferTrackInfo);
track.Year = Choose ((int)file.Tag.Year, track.Year, preferTrackInfo);
+ track.Bpm = Choose ((int)file.Tag.BeatsPerMinute, track.Bpm, preferTrackInfo);
if (String.IsNullOrEmpty (track.TrackTitle)) {
try {
@@ -136,6 +146,27 @@
}
} catch {}
}
+
+ // TODO look for track number in the file name if not set?
+ // TODO could also pull artist/album from folders _iff_ files two levels deep in the MusicLibrary folder
+ // TODO these ideas could also be done in an extension that collects such hacks
+ }
+
+ private static bool IsCompilation (TagLib.Tag tag)
+ {
+ TagLib.Id3v2.Tag id3v2_tag = tag as TagLib.Id3v2.Tag;
+ if (id3v2_tag != null && id3v2_tag.IsCompilation)
+ return true;
+
+ TagLib.Mpeg4.AppleTag apple_tag = tag as TagLib.Mpeg4.AppleTag;
+ if (apple_tag != null && apple_tag.IsCompilation)
+ return true;
+
+ if (tag.Performers.Length > 0 && tag.AlbumArtists.Length > 0 &&
+ (tag.Performers.Length != tag.AlbumArtists.Length || tag.FirstAlbumArtist != tag.FirstPerformer)) {
+ return true;
+ }
+ return false;
}
public static void TrackInfoMerge (TrackInfo track, StreamTag tag)
@@ -173,8 +204,13 @@
track.AlbumTitle = Choose ((string)tag.Value, track.AlbumTitle);
break;
case CommonTags.Disc:
+ case CommonTags.AlbumDiscNumber:
int disc = (int)tag.Value;
- track.Disc = disc == 0 ? track.Disc : disc;
+ track.DiscNumber = disc == 0 ? track.DiscNumber : disc;
+ break;
+ case CommonTags.AlbumDiscCount:
+ int count = (int)tag.Value;
+ track.DiscCount = count == 0 ? track.DiscCount : count;
break;
case CommonTags.Genre:
track.Genre = Choose ((string)tag.Value, track.Genre);
@@ -198,6 +234,9 @@
case CommonTags.TrackCount:
track.TrackCount = (int)tag.Value;
break;
+ case CommonTags.BeatsPerMinute:
+ track.Bpm = (int)tag.Value;
+ break;
case CommonTags.Duration:
if (tag.Value is TimeSpan) {
track.Duration = (TimeSpan)tag.Value;
@@ -212,6 +251,9 @@
case CommonTags.Year:
track.Year = (uint)tag.Value;
break;*/
+ case CommonTags.NominalBitrate:
+ track.BitRate = (int)tag.Value;
+ break;
case CommonTags.StreamType:
track.MimeType = (string)tag.Value;
break;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumInfo.cs Tue Aug 19 19:05:46 2008
@@ -50,7 +50,7 @@
}
private static HyenaSqliteCommand select_command = new HyenaSqliteCommand (String.Format (
- "SELECT {0} FROM {1} WHERE {2} AND CoreAlbums.ArtistID = ? AND CoreAlbums.Title = ?",
+ "SELECT {0} FROM {1} WHERE {2} AND CoreAlbums.ArtistID = ? AND CoreAlbums.Title = ? AND CoreAlbums.IsCompilation = ?",
provider.Select, provider.From,
(String.IsNullOrEmpty (provider.Where) ? "1=1" : provider.Where)
));
@@ -63,6 +63,7 @@
private static int last_artist_id;
private static string last_title;
+ private static bool last_compilation;
private static DatabaseAlbumInfo last_album;
public static void Reset ()
@@ -72,16 +73,17 @@
last_album = null;
}
- public static DatabaseAlbumInfo FindOrCreate (DatabaseArtistInfo artist, string title)
+ public static DatabaseAlbumInfo FindOrCreate (DatabaseArtistInfo artist, string title, bool isCompilation)
{
DatabaseAlbumInfo album = new DatabaseAlbumInfo ();
album.Title = title;
+ album.IsCompilation = isCompilation;
return FindOrCreate (artist, album);
}
public static DatabaseAlbumInfo FindOrCreate (DatabaseArtistInfo artist, DatabaseAlbumInfo album)
{
- if (album.Title == last_title && artist.DbId == last_artist_id && last_album != null) {
+ if (album.Title == last_title && artist.DbId == last_artist_id && last_album != null && last_compilation == album.IsCompilation) {
return last_album;
}
@@ -89,21 +91,25 @@
album.Title = Catalog.GetString ("Unknown Album");
}
- using (IDataReader reader = ServiceManager.DbConnection.Query (select_command, artist.DbId, album.Title)) {
+ using (IDataReader reader = ServiceManager.DbConnection.Query (select_command, artist.DbId, album.Title, album.IsCompilation)) {
if (reader.Read ()) {
last_album = provider.Load (reader);
- last_album.ArtistId = artist.DbId;
- last_album.ArtistName = artist.Name;
+ // If the artist name has changed since last time (but it's the same artist) then update our copy of the ArtistName
+ if (last_album.ArtistName != artist.Name) {
+ last_album.ArtistName = artist.Name;
+ last_album.Save ();
+ }
} else {
+ album.ArtistId = artist.DbId;
+ album.ArtistName = artist.Name;
+ album.Save ();
last_album = album;
- last_album.ArtistId = artist.DbId;
- last_album.ArtistName = artist.Name;
- last_album.Save ();
}
}
last_title = album.Title;
last_artist_id = artist.DbId;
+ last_compilation = album.IsCompilation;
return last_album;
}
@@ -114,6 +120,7 @@
// Overwrite the found album
album.Title = found.Title;
album.ArtistName = found.ArtistName;
+ album.IsCompilation = found.IsCompilation;
album.dbid = found.DbId;
album.ArtistId = found.ArtistId;
album.Save ();
@@ -154,6 +161,12 @@
get { return base.ReleaseDate; }
set { base.ReleaseDate = value; }
}
+
+ [DatabaseColumn]
+ public override bool IsCompilation {
+ get { return base.IsCompilation; }
+ set { base.IsCompilation = value; }
+ }
[DatabaseColumn]
public override string Title {
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseArtistInfo.cs Tue Aug 19 19:05:46 2008
@@ -90,8 +90,8 @@
if (reader.Read ()) {
last_artist = provider.Load (reader);
} else {
+ artist.Save ();
last_artist = artist;
- last_artist.Save ();
}
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs Tue Aug 19 19:05:46 2008
@@ -122,7 +122,7 @@
}
public DatabaseAlbumInfo Album {
- get { return DatabaseAlbumInfo.FindOrCreate (DatabaseArtistInfo.FindOrCreate (AlbumArtist), AlbumTitle); }
+ get { return DatabaseAlbumInfo.FindOrCreate (DatabaseArtistInfo.FindOrCreate (AlbumArtist), AlbumTitle, IsCompilation); }
}
private static bool notify_saved = true;
@@ -224,8 +224,7 @@
if (value == null)
return;
- // Overwrite the AlbumArtist if it was set to our old value
- if (String.IsNullOrEmpty (AlbumArtist) || AlbumArtist == ArtistName) {
+ if (!IsCompilation) {
AlbumArtist = value;
}
@@ -260,6 +259,15 @@
}
}
+ [VirtualDatabaseColumn ("IsCompilation", "CoreAlbums", "AlbumID", "AlbumID")]
+ public override bool IsCompilation {
+ get { return base.IsCompilation; }
+ set {
+ base.IsCompilation = value;
+ album_changed = album_changed != null;
+ }
+ }
+
private static string CleanseString (string input, string old_val)
{
if (input == old_val)
@@ -389,9 +397,15 @@
}
[DatabaseColumn]
- public override int Disc {
- get { return base.Disc; }
- set { base.Disc = value; }
+ public override int DiscNumber {
+ get { return base.DiscNumber; }
+ set { base.DiscNumber = value; }
+ }
+
+ [DatabaseColumn]
+ public override int DiscCount {
+ get { return base.DiscCount; }
+ set { base.DiscCount = value; }
}
[DatabaseColumn]
@@ -419,6 +433,18 @@
}
[DatabaseColumn]
+ public override string Conductor {
+ get { return base.Conductor; }
+ set { base.Conductor = value; }
+ }
+
+ [DatabaseColumn]
+ public override string Grouping {
+ get { return base.Grouping; }
+ set { base.Grouping = value; }
+ }
+
+ [DatabaseColumn]
public override string Copyright {
get { return base.Copyright; }
set { base.Copyright = value; }
@@ -436,7 +462,19 @@
set { base.Comment = value; }
}
- [DatabaseColumn ("Rating")]
+ [DatabaseColumn("BPM")]
+ public override int Bpm {
+ get { return base.Bpm; }
+ set { base.Bpm = value; }
+ }
+
+ [DatabaseColumn]
+ public override int BitRate {
+ get { return base.BitRate; }
+ set { base.BitRate = value; }
+ }
+
+ [DatabaseColumn("Rating")]
protected int rating;
public override int Rating {
get { return rating; }
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs Tue Aug 19 19:05:46 2008
@@ -52,8 +52,8 @@
// NOTE: Whenever there is a change in ANY of the database schema,
// this version MUST be incremented and a migration method
// MUST be supplied to match the new version number
- protected const int CURRENT_VERSION = 18;
- protected const int CURRENT_METADATA_VERSION = 3;
+ protected const int CURRENT_VERSION = 19;
+ protected const int CURRENT_METADATA_VERSION = 4;
#region Migration Driver
@@ -492,6 +492,22 @@
}
#endregion
+
+#region Version 19
+
+ [DatabaseVersion (19)]
+ private bool Migrate_19 ()
+ {
+ Execute ("ALTER TABLE CoreAlbums ADD COLUMN IsCompilation INTEGER DEFAULT 0");
+ Execute ("ALTER TABLE CoreTracks ADD COLUMN BPM INTEGER");
+ Execute ("ALTER TABLE CoreTracks ADD COLUMN DiscCount INTEGER");
+ Execute ("ALTER TABLE CoreTracks ADD COLUMN Conductor TEXT");
+ Execute ("ALTER TABLE CoreTracks ADD COLUMN Grouping TEXT");
+ Execute ("ALTER TABLE CoreTracks ADD COLUMN BitRate INTEGER DEFAULT 0");
+ return true;
+ }
+
+#endregion
#pragma warning restore 0169
@@ -550,6 +566,7 @@
UriType INTEGER,
MimeType TEXT,
FileSize INTEGER,
+ BitRate INTEGER,
Attributes INTEGER DEFAULT {0},
LastStreamError INTEGER DEFAULT {1},
@@ -558,10 +575,13 @@
TrackNumber INTEGER,
TrackCount INTEGER,
Disc INTEGER,
+ DiscCount INTEGER,
Duration INTEGER,
Year INTEGER,
Genre TEXT,
Composer TEXT,
+ Conductor TEXT,
+ Grouping TEXT,
Copyright TEXT,
LicenseUri TEXT,
@@ -573,7 +593,8 @@
LastSkippedStamp INTEGER,
DateAddedStamp INTEGER,
DateUpdatedStamp INTEGER,
- MetadataHash TEXT
+ MetadataHash TEXT,
+ BPM INTEGER
)
", (int)TrackMediaAttributes.Default, (int)StreamPlaybackError.None));
Execute("CREATE INDEX CoreTracksPrimarySourceIndex ON CoreTracks(ArtistID, AlbumID, PrimarySourceID, Disc, TrackNumber, Uri)");
@@ -596,6 +617,7 @@
ReleaseDate INTEGER,
Duration INTEGER,
Year INTEGER,
+ IsCompilation INTEGER DEFAULT 0,
ArtistName TEXT,
ArtistNameLowered TEXT,
@@ -702,7 +724,7 @@
FROM CoreArtists
WHERE Name = Tracks.Artist
LIMIT 1),
- 0, null, AlbumTitle, NULL, ReleaseDate, 0, 0, Artist, NULL, 0
+ 0, null, AlbumTitle, NULL, ReleaseDate, 0, 0, 0, Artist, NULL, 0
FROM Tracks
ORDER BY AlbumTitle
");
@@ -726,17 +748,17 @@
Uri,
0,
MimeType,
- 0,
+ 0, 0,
{0},
{1},
Title, NULL,
TrackNumber,
TrackCount,
- 0,
+ 0, 0,
Duration * 1000,
Year,
Genre,
- NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
Rating,
NumberOfPlays,
0,
@@ -744,7 +766,7 @@
NULL,
DateAddedStamp,
DateAddedStamp,
- NULL
+ NULL, NULL
FROM Tracks
", (int)TrackMediaAttributes.Default, (int)StreamPlaybackError.None));
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/TrackEditor.cs Tue Aug 19 19:05:46 2008
@@ -91,7 +91,7 @@
AlbumArtist = track.AlbumArtist ?? String.Empty;
TrackTitle = track.TrackTitle ?? String.Empty;
Genre = track.Genre ?? String.Empty;
- Disc = track.Disc;
+ Disc = track.DiscNumber;
TrackNumber = track.TrackNumber;
TrackCount = track.TrackCount;
Year = track.Year;
@@ -106,7 +106,7 @@
track.AlbumArtist = AlbumArtist;
track.TrackTitle = TrackTitle;
track.Genre = Genre;
- track.Disc = Disc;
+ track.DiscNumber = Disc;
track.TrackNumber = TrackNumber;
track.TrackCount = TrackCount;
track.Uri = Uri;
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 Tue Aug 19 19:05:46 2008
@@ -81,7 +81,7 @@
AudioCdTrackInfo track = new AudioCdTrackInfo (this, volume.DeviceNode, i);
track.TrackNumber = i + 1;
track.TrackCount = n;
- track.Disc = 1;
+ track.DiscNumber = 1;
track.Duration = TimeSpan.FromSeconds (mb_disc.TrackDurations[i]);
track.ArtistName = Catalog.GetString ("Unknown Artist");
track.AlbumTitle = Catalog.GetString ("Unknown Album");
@@ -158,7 +158,7 @@
model_track.TrackTitle = track.Title;
model_track.ArtistName = track.Artist.Name;
model_track.AlbumTitle = release.Title;
- model_track.Disc = disc_number;
+ model_track.DiscNumber = disc_number;
model_track.Album = album;
model_track.Artist = new DatabaseArtistInfo ();
Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdSource.cs Tue Aug 19 19:05:46 2008
@@ -177,7 +177,7 @@
CoreTracks.AlbumID = CoreAlbums.AlbumID AND
CoreArtists.Name = ? AND CoreAlbums.Title = ? AND (CoreTracks.Disc = ? OR CoreTracks.Disc = 0)",
ServiceManager.SourceManager.MusicLibrary.DbId,
- track.ArtistName, track.AlbumTitle, track.Disc
+ track.ArtistName, track.AlbumTitle, track.DiscNumber
);
if (count > 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]