惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
博客园_首页
S
SegmentFault 最新的问题
罗磊的独立博客
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
D
Docker
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
V
V2EX
大猫的无限游戏
大猫的无限游戏
V
Visual Studio Blog
腾讯CDC
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Help Net Security
博客园 - Franky
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏

Hub's wlog

Hub's wlog - Dia with GTK 3 Hub's wlog - Dev Log August 2023 Hub's wlog - libopenraw Rust with C API Hub's wlog - Niepce July 2023 updates Hub's wlog - Life update Hub's wlog - Niepce May 2023 updates Hub's wlog - Niepce April 2023 updates Hub's wlog - Niepce March 2023 updates Hub's wlog - Integrating the RawTherapee engine Hub's wlog - Niepce February 2023 updates Hub's wlog - Implementing i18n-format, a Rust procedural macro Hub's wlog - Niepce January 2023 updates Hub's wlog - i18n-format for Rust Hub's wlog - Introducing Toot That! Hub's wlog - Niepce December 2022 updates Hub's wlog - Niepce November 2022 updates Hub's wlog - Fall of releases Hub's wlog - Introducing Compiano Hub's wlog - RTKit, portals, and Pipewire Hub's wlog - Release day Hub's wlog - Update on Niepce Hub's wlog - New Again
Hub's wlog - Niepce June 2023 updates
:: Hubert Figuière · 2023-07-01 · via Hub's wlog

2023.07.01

This is the June 2023 update for Niepce.

The importer

Back where we left, still working on the import.

It looks like there is more work than anticipated to be able to import a tree a files.

The database model

The database model was designed a while ago, when some of the concepts I had in mind weren't clear enough. So this needs to be fixed. First I need to make folders unique on the parent and the name. With the current design a folder is a physical directory on the filesystem, which is way simpler than the idea I had. Since updating the database schema also mean upgrading, I took the opportunity to make keywords unique on the keyword and parent (they are in a hierarchical organisation too).

File management

Since the inception I had the plan to have two kinds of way to "store" image imported. Managed and mot managed. Managed meant that the file would be "owned" by the library, copied into a location controlled by the app. Not managed meant it's just a reference to a file on the filesystem. This concept idea came from Apple Aperture™ that did just that, where you'd have a library occuping dozens of GB on your disk. The storage layout of the files was abstracted.

Instead I decided to simplify the approach. Importing files will by default reference, or will copy into a specific location (when importing from a camera, only the latter). The folders are actual directories in storage and this goes hand in hand with the recursive import.

So I just ripped out the Managed enum wherever it was used and ignored. This was unfortunately ported from the C++ code a while ago.

UI bug

Of course this look like an onion I peel, with each layer that make me cry. This one is a crash in the GTK code, but it was triggered by a bad algorithm causing an attempt to load an item out of the array bounds. Part of the fix is to use #[must_use] for the container associated function to prevent ignoring the result. The gorry detail is that the (custom) container push() associated functions returns the old item if it is being replaced. It happen that the code assumed the len() increased all the time. Forcing to check the return value guards (with a warning) that the result not get ignored, and in that case properly handling the container size.

The result

The main patch got merged. It adds a recursive flag to the file import UI, and update the copy_importer example that I use for manually testing. From a storage standpoint it works:

select * from folders;
1||Trash|0|1|1|0|0
32|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022|2022|0|0|0|0|0
33|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220814|20220814|0|0|0|0|32
34|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220815|20220815|0|0|0|0|32
35|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220816|20220816|0|0|0|0|32
36|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220817|20220817|0|0|0|0|32
37|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220819|20220819|0|0|0|0|32
38|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220820|20220820|0|0|0|0|32
39|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220821|20220821|0|0|0|0|32
40|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20220824|20220824|0|0|0|0|32
41|/var/home/hub/Pictures/Camera import 2023-04-09 004747/2022/20221031|20221031|0|0|0|0|32

The last column is the parent_id that reference id, the first column. So the hierarchy is here.

However the UI is still not doing it:

Workspace

All the folder items should be below the 2022 folde while here they are on the same level. Note the disclosure triangles are a limitation of GtkListView.

What's next

Definitely I need to finish the UI. Some bugs are left and as well as the UI to pick the destination folders in the import dialog.

Also needing fixing is the display hierarchical keyword, I already did some work for it with the database schema update.

Thanks you for reading.