Home / Community / Blog

I want to import my pictures tags made in F-Spot (0.8.2) to digiKam (4.10)

I found Roland Geider script but it doesn't work in totay's Linux (differences in DBUS structure): Original F-Spot to digiKam script.

I've made trivial correction (comment-out problematic code) and now script looks like this:

You have to provide collection with the same path like in F-Spot. It can import tags.

If your F-Spot path doesn't exists anymore you have to alter photos.db. In my case some of pictures had path /home/zdjatka and some /mnt/zdjatka, but now all pictures are in the same place /mnt/zdjatka, so I alter path:

cp ~/.config/f-spot/photos.db ~/photos.db
sqlite3 ~/photos.db
update photos \
set base_uri=REPLACE(base_uri, "home", "mnt") \
where base_uri not like "%/mnt/zdjatka%";
update photo_versions \
set base_uri=REPLACE(base_uri, "home", "mnt") \
where base_uri not like "%/mnt/zdjatka%";
.quit

as you can see photos.db is sqlite3 database (usually located at ~/.config/f-spot/photos.db) and I copied file to home directory (not to modify original file).

Assuming you digiKam is initialized in Pictures directory and you have defined collection in same folder as is defined in F-Spot database (photos.db) complete command to convert is:

python fspot_to_digikam.py Pictures --fspot-folder .

Today most of my sites stopped to work. After some time I've noticed that PostgreSQL has some problem with locale:

psql: FATAL:  database locale is incompatible with operating system
DETAIL:  The database was initialized with LC_COLLATE "pl_PL.UTF-8",  which is not recognized by setlocale().
HINT:  Recreate the database with another locale or install the missing locale.

I've found similar symptoms in thread "Problem with locales on Linux with 9.3.4" posted by Hubert "depesz" Lubaczewski.

My databases has collation pl_PL.UTF-8:

                                           List of databases
        Name        |       Owner        | Encoding |  Collation  |    Ctype    |   Access privileges
--------------------+--------------------+----------+-------------+-------------+-----------------------
 eztest-demo        | xxxxxxxx           | UTF8     | pl_PL.UTF-8 | pl_PL.UTF-8 |
 eztest-flow        | xxxxxxxx           | UTF8     | pl_PL.UTF-8 | pl_PL.UTF-8 |
 eztest-web         | xxxxxxxx           | UTF8     | pl_PL.UTF-8 | pl_PL.UTF-8 |

and this locale was installed:

[root@jaqb ~]# locale -a | grep pl
pl_PL
pl_PL.iso88592
pl_PL.utf8

The solution: Restart PostgreSQL ;-)

[root@jaqb ~]# /etc/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]
[root@jaqb ~]# psql eztest-web
psql (8.4.20)
Type "help" for help.

eztest-web=>

That's all.

Dawno tego nie robiłem, więc już zapomniałem co począć ze świeżo zaistalowanym serwerem PostgreSQL'a. To to pokolei:

  • inicjuję bazę

    /etc/init.d/postgresql initdb
    
  • podłączam się do bazy

    su - postgres -c psql template1
    

    taka konstrukacja to dla tego, że użytkownik root nie ma dostępu do bazy

  • zakładam użytkowninka

    CREATE USER firstuser;
    
  • ustawiam mu hasło

    ALTER USER firstuser PASSWORD 'jegohaslo';
    
  • zakładam bazę

    CREATE DATABASE firstdb WITH OWNER firstuser \
                                TEMPLATE template0 \
                                LC_COLLATE 'pl_PL.UTF-8' \
                                LC_CTYPE 'pl_PL.UTF-8';

Zamiast tworzyć użytkowników i bazy z poziomu użytkownika postgres można zmienić w pliku /var/lib/pgsql/data/pg_hba.conf metodę autoryzacji z ident na trust w wierszu

host    all         all         127.0.0.1/32          ident

,ale to rozwiązanie nie jest bezpieczne, bo autoryzuje każdego użytkownika podłączającego się lokalnie. Docelowo można zmienić metodę autoryzacji na md5.

Żeby wymusić połączenie po IP a nie po gniazdach (ang. socket) można dodać parametr -h localhost.

Miałem taki problem: jest sobie baza MySQL'a na serwerze do którego nie miałem innego dostępu - jak tu teraz zarządzać bazą? Oczywiście można

mysql  --password --user=mojuser --host=jakistam.pl fajnabaza

ale to jest rozwiązanie dla pianistów. Webowy program phpMyAdmin również pozwala na zdalną pracę wystarczy podać mu namiary na sewrer(y) w pliku

/etc/phpmyadmin/config.php

Ja dopisałem:

$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'jakistam.pl';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = true;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

jak widać włączyłem kompresję i zmieniłem typ połączenia na mysqli. Można dopisać więcej jak ktoś lubi, tylko trzeba pamiętać o zwiększaniu licznika ($i++;) przed każdą nową konfiguracją.

Jakby komuś jeszcze tego było mało to może uruchomić MySQL Workbench, ale u mnie do zdalnej pracy u mnie brakowało mu pliku

/usr/lib/mysql-workbench/mysqlcppconn.so

którego nie było w pakiecie

libmysqlcppconn1

a gdzie indziej nie miałem czasu szukać.

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30