Package: digikam
Version: 4:3.5.0-3+b3
Severity: normal
Tags: upstream

Dear Maintainer,

Digikam no longer displays any album thumbnails (icons). I run Digikam
on Sid with a MySQL database running on Wheezy i386 (.deb mysql-server
5.5.35+dfsg-0+wheezy1).

Here follows a description of the error situation in my Digikam
database.

Data for one of the affected albums:

mysql> select * from Albums where relativePath like '%Foo'\G
          id: 634
   albumRoot: 1
relativePath: /2014/2014-01-23 Foo
        date: 2014-01-23
     caption: 
  collection: Bar
        icon: 32366

mysql> select * from Images where id=32366\G
              id: 32366
           album: NULL
            name: IMG_1185.JPG
          status: 3
        category: 1
modificationDate: 2014-01-25 13:09:08
        fileSize: 2615231
      uniqueHash: 1398e937cee377df7fc61536023cbd01

mysql> select * from Images where id=32366 or name='IMG_1185.JPG'\G
*************************** 1. row ***************************
              id: 34478
           album: 634
            name: IMG_1185.JPG
          status: 1
        category: 1
modificationDate: 2014-01-25 13:09:08
        fileSize: 2615231
      uniqueHash: 1398e937cee377df7fc61536023cbd01
*************************** 2. row ***************************
              id: 32366
           album: NULL
            name: IMG_1185.JPG
          status: 3
        category: 1
modificationDate: 2014-01-25 13:09:08
        fileSize: 2615231
      uniqueHash: 1398e937cee377df7fc61536023cbd01

We see that there exists two rows for the icon in the Images
tables. The image with status=1 is the one that is currently in the
album. The problem is that the album's icon points to the image with
status=3 which is no longer in the album.

The query that Digikam uses for finding album icons requires that the
icon image is in the album. From
<http://api.kde.org/extragear-api/graphics-apidocs/digikam/html/albumdb_8cpp_source.html#l00252>:

d->db->execSql("SELECT A.albumRoot, A.id, A.relativePath, A.date, A.caption, 
A.collection, B.albumRoot, B.relativePath, I.name \n "
  "FROM Albums AS A \n "
  " LEFT JOIN Images AS I ON A.icon=I.id \n"
  " LEFT JOIN Albums AS B ON B.id=I.album \n"
  " WHERE A.albumRoot != 0;", // exclude stale albums
  &values);

I don't know what causes Digikam to create multiple rows for images
and have them differ by their status. But it should preserve album
icons.

An affected Digikam database can be repaired by following the
instructions below.

Backup the databases:

$ mysqldump digikam > ~/digikam-$(date +%F).sql
$ mysqldump digikamthumbnails > ~/digikamthumbnails-$(date +%F).sql

List the albums with missing icons where the icon exists as another
image in the database:

mysql> select A.id, A.relativePath, I.id, I.status, I.name, I2.id,
  I2.status, I2.name, I2.album from Albums as A
  join Images as I on A.icon = I.id
  join Images as I2 on I.uniqueHash = I2.uniqueHash and I.id <> I2.id and 
I2.album = A.id
  where I.album is null order by A.relativePath;

Generate update statements for the albums with repairable icons:

mysql> select concat('update Albums set icon=', I2.id, ' where id=', A.id, ';')
  from Albums as A
  join Images as I on A.icon = I.id
  join Images as I2 on I.uniqueHash = I2.uniqueHash and I.id <> I2.id and 
I2.album = A.id
  where I.album is null order by A.relativePath
  into outfile '/tmp/digikam-fix-album-icons.sql';

Run the generated updates:

$ mysql digikam < /tmp/digikam-fix-album-icons.sql

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.utf8)
Shell: /bin/sh linked to /bin/dash

Versions of packages digikam depends on:
ii  digikam-data          4:3.5.0-3
ii  digikam-private-libs  4:3.5.0-3+b3
ii  kde-runtime           4:4.11.5-1
ii  libc6                 2.18-4
ii  libgcc1               1:4.8.2-19
ii  libgphoto2-6          2.5.3.1-1
ii  libgphoto2-port10     2.5.3.1-1
ii  libkdcraw22           4:4.11.5-1
ii  libkdecore5           4:4.11.5-1
ii  libkdeui5             4:4.11.5-1
ii  libkexiv2-11          4:4.11.5-2
ii  libkhtml5             4:4.11.5-1
ii  libkio5               4:4.11.5-1
ii  libkipi11             4:4.11.5-1
ii  libknotifyconfig4     4:4.11.5-1
ii  libkparts4            4:4.11.5-1
ii  libphonon4            4:4.7.1-1
ii  libqt4-dbus           4:4.8.5+git242-g0315971+dfsg-2
ii  libqt4-sql            4:4.8.5+git242-g0315971+dfsg-2
ii  libqt4-sql-sqlite     4:4.8.5+git242-g0315971+dfsg-2
ii  libqt4-xml            4:4.8.5+git242-g0315971+dfsg-2
ii  libqtcore4            4:4.8.5+git242-g0315971+dfsg-2
ii  libqtgui4             4:4.8.5+git242-g0315971+dfsg-2
ii  libsolid4             4:4.11.5-1
ii  libstdc++6            4.8.2-19
ii  libthreadweaver4      4:4.11.5-1
ii  perl                  5.18.2-2+b1
ii  phonon                4:4.7.1-1

Versions of packages digikam recommends:
ii  chromium [www-browser]              33.0.1750.152-1
ii  google-chrome-stable [www-browser]  33.0.1750.152-1
ii  iceweasel [www-browser]             24.4.0esr-1
ii  kipi-plugins                        4:3.5.0-3+b3
ii  konqueror [www-browser]             4:4.11.5-2
ii  lynx-cur [www-browser]              2.8.8pre5-1
ii  midori [www-browser]                0.4.3+dfsg-0.1
ii  mplayerthumbs                       4:4.11.3-1
ii  w3m [www-browser]                   0.5.3-15

Versions of packages digikam suggests:
pn  digikam-doc     <none>
ii  systemsettings  4:4.11.8-1

-- no debconf information

_______________________________________________
pkg-kde-extras mailing list
pkg-kde-extras@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-kde-extras

Reply via email to