banshee r4100 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database src/Extensions/Banshee.CoverArt/Banshee.CoverArt
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4100 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database src/Extensions/Banshee.CoverArt/Banshee.CoverArt
- Date: Tue, 3 Jun 2008 23:35:48 +0000 (UTC)
Author: gburt
Date: Tue Jun 3 23:35:48 2008
New Revision: 4100
URL: http://svn.gnome.org/viewvc/banshee?rev=4100&view=rev
Log:
2008-06-03 Gabriel Burt <gabriel burt gmail com>
* src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs: Avoid
issue with last_scan being MinValue and trying to subtract retry_every
from it. Also, wrap the entire fetch loop in a try/catch to make sure we
exit the user job and log any exception.
* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
Don't stop the entire migration because one track fails. Log the
exception, and keep going.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
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 Jun 3 23:35:48 2008
@@ -759,27 +759,25 @@
try {
track = DatabaseTrackInfo.Provider.Load (reader);
- if (track == null || track.Uri == null || !track.Uri.IsFile)
- continue;
-
- try {
- TagLib.File file = StreamTagger.ProcessUri (track.Uri);
- StreamTagger.TrackInfoMerge (track, file, true);
- } catch (Exception e) {
- Log.Warning (String.Format ("Failed to update metadata for {0}", track),
- e.GetType ().ToString (), false);
+ if (track != null && track.Uri != null && track.Uri.IsFile) {
+ try {
+ TagLib.File file = StreamTagger.ProcessUri (track.Uri);
+ StreamTagger.TrackInfoMerge (track, file, true);
+ } catch (Exception e) {
+ Log.Warning (String.Format ("Failed to update metadata for {0}", track),
+ e.GetType ().ToString (), false);
+ }
+
+ track.Save (false);
+ track.Artist.Save ();
+ track.Album.Save ();
+
+ job.Status = String.Format ("{0} - {1}", track.DisplayArtistName, track.DisplayTrackTitle);
}
-
- track.Save (false);
- track.Artist.Save ();
- track.Album.Save ();
} catch (Exception e) {
Log.Warning (String.Format ("Failed to update metadata for {0}", track), e.ToString (), false);
- job.Finish ();
- throw;
}
- job.Status = String.Format ("{0} - {1}", track.DisplayArtistName, track.DisplayTrackTitle);
job.Progress = (double)++count / (double)total;
}
}
Modified: trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs Tue Jun 3 23:35:48 2008
@@ -82,6 +82,13 @@
public CoverArtJob (DateTime lastScan) : base (Catalog.GetString ("Downloading Cover Art"))
{
last_scan = lastScan;
+
+ // Since we do last_scan - retry_every, avoid out-of-range error by ensuring
+ // the last_scan date isn't already MinValue
+ if (last_scan == DateTime.MinValue) {
+ last_scan = DateTime.Now - TimeSpan.FromDays (300);
+ }
+
CanCancel = true;
}
@@ -106,33 +113,37 @@
int current = 0;
int total = 0;
- DatabaseTrackInfo track = new DatabaseTrackInfo ();
- while (true) {
- total = current + ServiceManager.DbConnection.Query<int> (count_query, last_scan, ServiceManager.SourceManager.MusicLibrary.DbId, last_scan - retry_every);
- if (total == 0 || total <= current) {
- break;
- }
+ try {
+ DatabaseTrackInfo track = new DatabaseTrackInfo ();
+ while (true) {
+ total = current + ServiceManager.DbConnection.Query<int> (count_query, last_scan, ServiceManager.SourceManager.MusicLibrary.DbId, last_scan - retry_every);
+ if (total == 0 || total <= current) {
+ break;
+ }
- using (IDataReader reader = RunQuery ()) {
- while (reader.Read ()) {
- if (IsCancelRequested) {
- Finish ();
- return;
- }
-
- track.AlbumTitle = reader.GetString (1);
- track.ArtistName = reader.GetString (2);
- track.AlbumId = Convert.ToInt32 (reader[0]);
+ using (IDataReader reader = RunQuery ()) {
+ while (reader.Read ()) {
+ if (IsCancelRequested) {
+ Finish ();
+ return;
+ }
+
+ track.AlbumTitle = reader.GetString (1);
+ track.ArtistName = reader.GetString (2);
+ track.AlbumId = Convert.ToInt32 (reader[0]);
- Progress = (double) current / (double) total;
- Status = String.Format (Catalog.GetString ("{0} - {1}"), track.ArtistName, track.AlbumTitle);
+ Progress = (double) current / (double) total;
+ Status = String.Format (Catalog.GetString ("{0} - {1}"), track.ArtistName, track.AlbumTitle);
- FetchForTrack (track);
- current++;
+ FetchForTrack (track);
+ current++;
+ }
}
}
+ } catch (Exception e) {
+ Log.Exception (e);
}
-
+
Finish ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]