Page 1 of 1

1.4.5 - database present but star rating ignored

Posted: Wed Jun 21, 2023 9:54 pm
by voyz
Hi! All of the sudden my current star ratings stopped working.

I was just going through some photos, and after copying some of them the star ratings are all gone.

I can make new stars, but all of my old star ratings disappeared. The database file is still here, contains some 146mb of data.

You can download it from here, this link will be available till 21/07/2023:

https://u.pcloud.link/publink/show?code ... hmNBb1TvrX

Any help on retrieving my star ratings would be much appreciated 🙏 thanks!

XnView: MP 1.4.5 - 64 bit
OS: Windows 11

Re: 1.4.5 - database present but star rating ignored

Posted: Thu Jun 22, 2023 1:49 pm
by xnview
which file for example doesn't show rating?

Re: 1.4.5 - database present but star rating ignored

Posted: Thu Jun 22, 2023 1:57 pm
by voyz
For example:

"C:\photos\sorted\BO_sucre_23_05\IMG_0037.JPG"

I've attached a screenshot to demonstrate. (Edit: I tried to but board quota has been reached - can I email you the screenshot?)

Note, that none of them show ratings.

Re: 1.4.5 - database present but star rating ignored

Posted: Fri Jun 23, 2023 9:09 am
by xnview
in your catalog, there is no more folder BO_sucre_23_05, so IMG_0037.JPG doesn't exist

Re: 1.4.5 - database present but star rating ignored

Posted: Fri Jun 23, 2023 3:59 pm
by voyz
Sorry, I'm not sure I'm following. When you say 'in your catalog', what are you referring to?

The files are there on the hard drive, nothing has changed. I've uploaded the screenshot online, you can see it here:

https://i.ibb.co/pyJBwMS/Screenshot-202 ... 085634.png

Image

Re: 1.4.5 - database present but star rating ignored

Posted: Wed Jun 28, 2023 9:39 am
by xnview
i means in the database, there is no BO_sucre_23_05 file

Re: 1.4.5 - database present but star rating ignored

Posted: Wed Jun 28, 2023 10:09 pm
by voyz
Sorry, I don't know what does that mean. Have I sent you a wrong database file? Like I say, that image had a star rating just before they all disappeared.

Re: 1.4.5 - database present but star rating ignored

Posted: Tue Jul 04, 2023 1:57 pm
by xnview
you talk about the file "C:\photos\sorted\BO_sucre_23_05\IMG_0037.JPG", but when i check the content of database, i don't see folder BO_sucre_23_05
So no rating is stored for this file

Re: 1.4.5 - database present but star rating ignored

Posted: Wed Jul 05, 2023 4:36 am
by voyz
I understand. That seems to be exactly my problem. That rating, and all the other ones are gone. I think this isn't the expected behaviour, right?

If I remember correctly, the ratings got corrupted/deleted when I pressed delete to remove all photos with rating '1', but then clicked 'cancel'.

Re: 1.4.5 - database present but star rating ignored

Posted: Wed Jul 05, 2023 6:54 am
by xnview
So if files are removed from database it's not possible to retrieve rating for these files

Re: 1.4.5 - database present but star rating ignored

Posted: Wed Jul 05, 2023 5:07 pm
by voyz
And any idea on how were they removed from the database? Like I say, I was using the software normally, they just disappeared magically one day.

Re: 1.4.5 - database present but star rating ignored

Posted: Wed Jul 05, 2023 7:42 pm
by voyz
Ok, I've figured out what the issue was.

In short - XnViewMP's database dbFolder can be set to a non-existing folder through `xnview.ini` file. It doesn't seem to create the folder if it doesn't exist, yet the program will work as if everything was fine.

You can create ratings and categories, yet these don't get saved anywhere and there's no warning that this is what's happening. These also don't get saved, and will disappear.

My suggestion would be to enforce creating the dbFolder specified in the `xnview.ini` file (or registry) on startup if one doesn't exist.


------------------------
Long answer:

### Reinstallation ###

I've had XnViewMP installed on my Windows 10 machine. There, the database folder was was set to `[XnViewMP ROOT]/database` path. Also, all my photos were on a secondary drive that was mounted as `C:/second/photos/...`.

About a month ago I unmounted the secondary drive, and installed Windows 11 on it. That drive still had all the photos on it, yet the paths were no longer `C:/second/photos/...` but on `C:/photos/...`.

After intalling XnViewMP on Win 11, I've copied the `xnview.ini`, `XnView.db` and `Thumb.db` files from my old drive. This is pretty standard procedure when copying over old configuration to a new system. I've found a number of resources on XnViewMP's forum regarding backups and database file that suggested this would be the right way to go.

Remember that in this `xnview.ini` file copied over from Win 10, the dbFolder was set as `[XnViewMP ROOT]/database` which was a folder that didn't exist on the new Win 11 installation. I didn't notice that, and having used XnViewMP for a few years I didn't remember whether I've set the database folder manually when I installed it originally on my Win 10 drive.

Therefore, I have a new XnViewMP installation, with database pointing to an non-existing folder. The old `XnView.db` database file was copied to the XnViewMP ROOT, but it wasn't being read. And the catalogue is expecting photos to be in `C:/second/photos/...` which doesn't exist. Pretty horrible setup.


### Getting back to work ###

Assuming that having copied these configuration files would be enough, I didn't check the existing catalogue or my old photos. If I would, I would have noticed that none of them had the old ratings. But instead I went on and started working.

I went through a couple of new folders with photos I took recently. I added rating on these, moved the files accordingly to my ratings, everything seemed to go in order. What I assume was happening, making me believe that things are in order, is that XnViewMP was storing the new ratings in its program memory, but not saving or cross-checking these with the database file. That's all reasonable.

However, then I wanted to delete some of the files I just rated for deletion (I say 'some' - it's around 2000 ratings and a couple of hours of work, but oh well), but upon reflecting I decided not to delete them yet. XnViewMP prompts me for 'Are you sure you want to delete these 600-something items?', and I press 'No'.

At this instance, all the new ratings I made were gone. I assume that this action caused XnViewMP to attempt to save or cross-check its catalogue with the database file. Since the file was pointing to a non-existing directory, it failed, and resulted to erasing all the ratings made during that session that were until then stored in the memory.

So I notice that something is strange, and go to check my old ratings, but can also not find these. This time the reason for that is due to the fact that they were pointing at `C:/second/photos/...` instead of `C:/photos/...`. However, until now I didn't know that, so I assumed that somehow all my database got corrupted when I declined deleting the photos. I didn't notice that these are two separate problems.


### Fixing the issues ###

I've reinstalled XnViewMP, imported the database from my Win 10 setup, and then relocated the folders from `C:/second/photos/...` to `C:/photos/` by going Tools -> Settings -> Catalog -> Relocate button.

The work I've done while the program was pointing at the non-existing database folder was lost. This also explains why we couldn't see `C:\photos\sorted\BO_sucre_23_05\IMG_0037.JPG` file in the catalogue - it is one of the files rated during that cursed memory-only session.

I think this points out a couple of places that could be improved:
  • Double check if dbFolder exists, and display a warning and/or create the folder on startup.
  • Warn when previously recognised catalogue folders are no longer present