“Fixing” a Banshee music database

08Apr10

NOTE: This is a bit verbose in the description, but maybe you can learn something from the process. If you just want to know how to fix the Banshee database after changing user name or moving your library to a different location, scroll down.

I recently reinstalled Ubuntu and in the process changed my user name to my more commonly used ‘cybolic’, however after copying the ~/.config/banshee-1 directory to my new home dir I realised that Banshee had all my music indexed by absolute path meaning that it was looking for my old home dir and so couldn’t play any tracks.

To fix it I assumed I would have to do a search and replace on its database, but I needed the filetype, so a quick ‘file ~/.config/banshee-1/banshee.db’ later I now knew that it was in SQLite 3.x format.

Now on to a tool to do the search and replace on the database…

Ubuntu has a tool in it’s repos called “sqlitebrowser”, that sounded about right, so I installed it and yes, it allowed me to browse the database and perform SQL queries – just what I needed.

So, long story short, to change the location of your music files in the Banshee database, here’s what you do (close Banshee first):

sudo aptitude install sqlitebrowser
sqlitebrowser ~/.config/banshee-1/banshee.db

Now change to the tab labelled “Execute SQL” and write something like the following:

update CoreTracks set Uri = replace(Uri, '/home/<olduser>', '/home/<newuser>');
update PodcastEnclosures set LocalPath = replace(LocalPath, '/home/<olduser>', '/home/<newuser>');

You are now done and can start Banshee again :)

About these ads


9 Responses to ““Fixing” a Banshee music database”

  1. 1 tidnab

    thx

  2. 2 Omar

    Just was i was looking for. Nice :-)

  3. 3 Nishchal

    If you still get messed just use following commands in sql (truncate commands doesn’t seem to work)

    “delete from CoreTracks”
    “delete from CoreAlbums”
    Then rescan your library. :)

  4. 4 Cristóbal

    Very usefull!! Thanks!

  5. 5 Aeron

    Awesome! Thanks!

  6. 6 SteveG

    This just saved me probably weeks of work re-rating all my music, something I was dreading since upgrading my network. Thank you very much for this.

    BTW, squlitebrowser can be found in the Ubuntu Software Center, and it works fine in 12.04.

  7. 7 Pierre

    Thanks ! This issue should be integrate in banshee itself

  8. 8 Thomas131

    Thank you!


  1. 1 Ubuntu Blog» Blogarchiv » Banshees Bibliothek umziehen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: