How to modify the F-Spot database

On my new Linux installation I wanted to have all my images in one folder. Due to some mishaps F-Spot had stored the images in three different locations. I looked a bit around and then found a forum post which described an easy way to do this.

Find your photos.db database. It’s usually in ./config/f-spot/. Then use sqlite3 to extract the information into a text file:

sqlite3 ~/.config/f-spot/photos.db .dump > f-spot.dump

If you stare wondering at a “bash: sqlite3: command not found”, just install the package “sqlite3-tools”.

Now open this file in your text editor (not word processor…..) of choice. You’ll see a lot of lines, among them images with paths. Just change these paths with search and replace to the new scheme.

INSERT INTO "photos" VALUES(4243,1243489564,'file:///home/rs/Pictures/Photos/2009/05/28/','RLF_9743.JPG','Rolf Steinort rolf.steinort@gmail.com',38,1,0);

Take care to only change the paths, don’t delete or change any of the other stuff. It can break everything. 😉

Now make a backup of your database and import the changed data back into the database.


mv ~/.config/f-spot/photos.db photos.db.backup
sqlite3 ~/.config/f-spot/photos.db < f-spot.dump

This is only working when no database is there, so make the backup! If you run into an error, delete the new database.

Of course you should only start F-Spot again if you are sure that all the files have reached their new destinations safely.

[flattr /]

Other news: Shotwell imports F-Spot data and images without problems. And #150 has been recorded the third time and is just in the rendering tool chain. I'll know about the result in some moments.

12 thoughts on “How to modify the F-Spot database

  1. > Just change these paths with search and replace to the new scheme.

    If the file is too big for the editor you can do it manually:
    sed -e ‘s/OLDPATH/NEWPATH/’ photos.db.new

    > And #150 has been recorded the third time and is just in the rendering tool chain.
    > I’ll know about the result in some moments.

    Let’s hope it works this time. Withdrawal symptoms are getting worse… 😉

  2. *grrrr* Markup eat the command line. Hope it works like this:

    sed -e ‘s/OLDPATH/NEWPATH/’ <photos.db.old >photos.db.new

  3. It should work out that way, but you have to use the dump file and not the .db. And you have to take care of escaping the / in the path names. It will look horrible…. 😉

  4. You’right. I assumed the files to be dumps. And I normally use æ or another character unlikely to appear for sed command separation but I didn’t know if they’d show up in the comment.

  5. No, I am using PCLinuxOS http://www.pclinuxos.com/ because the whole Ubuntu family is not working with my screen recorder. Up to now I like it. And i am still on Gnome, after 2 weeks of KDE I decided that I am a Gnome guy.

    (#150 is half editied, publishing tomorrow if the tool chain for rendering the MP4 is working.)

  6. This is one of the reasons that I can’t seem to switch to f-spot. I really don’t like that all the pictures need to be in a database. One of the things I really like about picasa is that if you move something it will find it and adjust appropriately. Is there anything like picasa that is native to linux?

  7. Hi Rolf!

    Can’t wait to see Your next show!

    Keep up to good work.

    @DMJZE

    Picasa is closed source and needs part of wine environment to work. Its also made by Google. I don’t trust Big Brother and been moving away from its products entire 2010. It went better then expected. Digikam is a fantastic open source tool for Photo management and basic maintenance under KDE. Have You tried it? I know qualities of picasa as I used to use it myself but I preffer to use digikam nowadays.

    Regards.

    Andy

  8. I use DigiKam too.
    I am on Ubuntu, and have some troubles with DigiKam. BUT, it is realy fantastic software with a greate functionality!

    BTW, DigiKam understand the .xcf files well

    Regards,
    Sergey.

  9. At the moment cinelerra is constantly crashing and avidemux aborts just after starting. PCLinuxOS seems not to be video friendly…..
    … problem looks solvable, the video file seems to be to large. Avidemux on the notebook to the rescue.

Anything to add from your side of the computer?

This site uses Akismet to reduce spam. Learn how your comment data is processed.