After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 440172 - Unable to load Podcast DB
Unable to load Podcast DB
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Podcasting
0.12.1
Other All
: Normal critical
: 2.x
Assigned To: Mike Urbanski
Mike Urbanski
: 440170 462652 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-05-21 13:00 UTC by Thilo
Modified: 2008-01-01 02:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
my banshee.db (98.49 KB, application/x-compressed-tar)
2007-06-26 21:39 UTC, Chris MIles
  Details
podcast datetime fix (1.60 KB, patch)
2007-08-06 19:46 UTC, Mike Urbanski
none Details | Review
Patch for src/Plugins/Banshee.Plugins.Podcast/PodcastDBManager.cs in banshee (3.32 KB, patch)
2007-08-07 06:56 UTC, Pontus Freyhult
none Details | Review

Description Thilo 2007-05-21 13:00:21 UTC
Please describe the problem:
Once I started Banshee did not start. I then restarted it from terminal and got the output below.



Steps to reproduce:


Actual results:
May podcasts are lost.

Expected results:
They should be there.

Does this happen every time?


Other information:
$ banshee            
Debug: [05/21/2007 14:48:37] (Loading audio profiles) - /usr/share/banshee/audio-profiles
Debug: [05/21/2007 14:48:38] (Default player engine) - GStreamer 0.10
Debug: [05/21/2007 14:48:39] (Audio CD Core Initialized) - 
Debug: [05/21/2007 14:48:39] (Audioscrobbler starting protocol engine) - 
Unable to load Podcast DB
System.FormatException: String was not recognized as a valid DateTime.
  at System.DateTime.Parse (System.String s, IFormatProvider fp, DateTimeStyles styles) [0x00000] 
  at System.DateTime.Parse (System.String s, IFormatProvider fp) [0x00000] 
  at System.DateTime.Parse (System.String s) [0x00000] 
  at Mono.Data.SqliteClient.SqliteDataReader.ReadpVm (IntPtr pVm, Int32 version, Mono.Data.SqliteClient.SqliteCommand cmd) [0x00000] 
  at Mono.Data.SqliteClient.SqliteDataReader..ctor (Mono.Data.SqliteClient.SqliteCommand cmd, IntPtr pVm, Int32 version) [0x00000] 
  at (wrapper remoting-invoke-with-check) Mono.Data.SqliteClient.SqliteDataReader:.ctor (Mono.Data.SqliteClient.SqliteCommand,intptr,int)
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32& rows_affected) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader () [0x00000] 
  at Banshee.Database.QueuedSqliteCommand.Execute () [0x00000] 
Setting IO Backend to Banshee.IO.Unix.IOConfig (unix)
Comment 1 Thilo 2007-05-21 13:24:45 UTC
*** Bug 440170 has been marked as a duplicate of this bug. ***
Comment 2 Thilo 2007-05-21 13:28:51 UTC
Mono version:
mono=1.2.4-0.1-1
Comment 3 Mike Urbanski 2007-05-21 21:04:15 UTC
Could you post a copy of your db file?

~Mike
Comment 4 Thilo 2007-05-21 21:20:21 UTC
Which would be $HOME/.gnome2/banshee/banshee.db ?
Comment 5 Mike Urbanski 2007-05-25 18:15:18 UTC
Yes, unless you're using SVN, then it would be $HOME/.config/banshee/banshee.db.
Comment 6 Chris MIles 2007-06-26 21:36:19 UTC
I also have this fault. Banshee 0.12.1, mono 1.2.4. It started a few days ago when I booted no podcasts listed. Running with banshee --debug reports:
Unable to load Podcast DB
System.FormatException: String was not recognized as a valid DateTime.
  at System.DateTime.Parse (System.String s, IFormatProvider fp, DateTimeStyles styles) [0x00000]
  at System.DateTime.Parse (System.String s, IFormatProvider fp) [0x00000]
  at System.DateTime.Parse (System.String s) [0x00000]
  at Mono.Data.SqliteClient.SqliteDataReader.ReadpVm (IntPtr pVm, Int32 version, Mono.Data.SqliteClient.SqliteCommand cmd) [0x00000]
  at Mono.Data.SqliteClient.SqliteDataReader..ctor (Mono.Data.SqliteClient.SqliteCommand cmd, IntPtr pVm, Int32 version) [0x00000]
  at (wrapper remoting-invoke-with-check) Mono.Data.SqliteClient.SqliteDataReader:.ctor (Mono.Data.SqliteClient.SqliteCommand,intptr,int)
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32& rows_affected) [0x00000]
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000]
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader () [0x00000]
  at Banshee.Database.QueuedSqliteCommand.Execute () [0x00034] in /home/jms/working/banshee-0.12.1+dfsg/src/Core/Banshee.Base/QueuedSqliteDatabase.cs:207

Comment 7 Chris MIles 2007-06-26 21:39:18 UTC
Created attachment 90714 [details]
my banshee.db
Comment 8 Chris MIles 2007-06-26 22:06:39 UTC
Phew - thanks for the comments here it helped me find the problem. The publication date "PubDate" on the Podcasts table were all in UK format, e.g. 18/06/2007 except for one that was in US format, i.e. 06/18/2007. After switching the first two fields around with SQL (update Podcasts set PubDate = "18/06/2007 18:00:00" where PubDate = "06/18/2007 18:00:00") I can start banshee and see my podcasts.
Comment 9 Pontus Freyhult 2007-08-06 15:37:50 UTC
It seems this issue can occur when working with different locales (with different time formats), updating or downloading podcasts can then break your database for another locale (this problem exists for at least sv-SE and C).

Inspired by <http://www.codeproject.com/csharp/cultureinvariantdatetime.asp>, I've drummed up a patch that seems to fix it for me (but this is my first time doing anything in C# so I just might have managed to do something crazy although it's a minimal patch, please review before applying :)
Comment 10 Mike Urbanski 2007-08-06 19:46:57 UTC
Created attachment 93167 [details] [review]
podcast datetime fix
Comment 11 Mike Urbanski 2007-08-06 19:47:32 UTC
That's about the same conclusion that I came to this weekend.  

SQLite will happily accept just about anything for a date/time field, only upon read will errors become evident.  As pontus mentioned, the problem crops up when an invalid datetime is put into the db with one locale and then read with another.

Using ISO-8601 formatted date-times [0], which are independent of the current culture and supported by both the DateTime structure and SQLite, should solve this issue.  

The fix is simple, patch attached.  

Pontus, where did you post your patch?

Side note to a seemingly international corwd:  Does anyone know of a good place to learn about general i18n?

[0]:  
* http://msdn2.microsoft.com/en-us/library/az4se3k1.aspx - the 's' format

* http://msdn2.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.sortabledatetimepattern.aspx       
       
*http://www.somacon.com/p370.php
Comment 12 Pontus Freyhult 2007-08-07 06:56:38 UTC
Created attachment 93188 [details] [review]
Patch for src/Plugins/Banshee.Plugins.Podcast/PodcastDBManager.cs in banshee 

Weird, I'm quite sure I really did attach this to the bug (and even felt guilty about doing the comment before attaching the patch, causing two mails to those watching).

Anyway, naturally, what I did was roughly the same although I thought one might as well go all the distance and store it in UTC (and mark it so). Not a big issue, but should be nice for those changing time zones when travelling.
Comment 13 Pontus Freyhult 2007-08-07 08:22:30 UTC
Although when looking more closely the patch in comment 11 doesn't fix the case for LastUpdated for PodcastFeeds, which needs fixing as well.
Comment 14 Pontus Freyhult 2007-08-07 14:15:41 UTC
And now I see that I managed to attach to 440738 first. Oh well.
Comment 15 Mike Urbanski 2007-08-08 01:10:26 UTC
Yeah, you're right about the patch, I must have diff'd before I saved.
Comment 16 David Nielsen 2007-08-20 13:03:01 UTC
*** Bug 462652 has been marked as a duplicate of this bug. ***
Comment 17 David Nielsen 2007-11-14 09:26:37 UTC
Is there any hope we might get this fixed for the next stable release - I'm getting somewhat fed up with having to force banshee to run using LANG=C to have podcast support.

Adding Gabriel to CC, hopefully he'll be able to check in a magic quick fix for Banshee will be useful to non-us people while we wait for real life to spit Mike back out.
Comment 18 Mike Urbanski 2007-11-14 15:44:52 UTC
I'll fix this today
Comment 19 Mike Urbanski 2008-01-01 02:10:11 UTC
Fixed in stable rev. 2936.