Bug 406506

Summary: Wish - Show metadata of files stored on locations non-indexed by baloo in details view mode
Product: [Applications] dolphin Reporter: Patrick Silva <bugseforuns>
Component: view-engine: details modeAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: ASSIGNED ---    
Severity: normal CC: dc.hart, elvis.angelaccio, funkybomber, hoperidesalone, kfm-devel, metal450, meven29, mte90net, nate, postix, sourcework, stefan.bruens, tagwerk19, tombrown9501, xenoidaltu
Priority: HI Keywords: usability
Version: 24.01.75   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: both info panel and "Details" tab of "Properties" window show the metadata

Description Patrick Silva 2019-04-13 14:47:50 UTC
SUMMARY
I use 1 hard disk to install/run my operating systems (Arch Linux and Windows 7)
and other 2 hard disks, both formatted with NTFS file system, to store my personal files.
Dolphin only shows metadata like width, height, track, artist, duration, album, bitrate, etc of files indexed by baloo. However, baloo does not index NTFS file systems. Therefore, currently I can't see the metadata of my personal files using Dolphin.
It would be very nice if Dolphin could show metadata of non-indexed files too.

STEPS TO REPRODUCE
1. use Dolphin to try see the metadata of files stored on NTFS file systems
2. 
3. 

OBSERVED RESULT
Dolphin does not show metadata of files stored on NTFS (non-indexed) file system.

EXPECTED RESULT
Dolphin shows metadata of files non-indexed by baloo.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.2
Comment 1 Nate Graham 2019-04-14 01:45:39 UTC
Probably it should just index NTFS disks...
Comment 2 Méven Car 2019-04-14 09:15:28 UTC

Or index temporarily (without history) all the files loaded in dolphin when it is not in an indexed path.
Or short-circuit baloo and extract metadata the same sort of way KPreviewJob does.

Volatile storage/temporary storage is a common use case, we could offer metadata there as well.
Comment 3 Patrick Silva 2019-04-14 10:25:21 UTC
Ntfs file system of internal hard disks is just an example.
Currently Dolphin also does not show metadata of files stored
in removable devices formatted with any file system.
Comment 4 Patrick Silva 2019-04-20 14:21:08 UTC
Created attachment 119527 [details]
both info panel and  "Details" tab of "Properties" window show the metadata

As we can see in my screenshot taken on neon dev unstable, both info panel and "Details" tab of "Properties" window show the metadata even when the file is not indexed.
Comment 5 Patrick Silva 2019-04-20 14:40:32 UTC
why was this bug closed?
Comment 6 Méven Car 2019-04-20 15:03:55 UTC
I did because I understood your last comment suggested the issue at hand does not exist.
And I checked myself.
Do you think it should stay open ?
Comment 7 Patrick Silva 2019-04-20 15:08:08 UTC
This report is about Dolphin. As we can see in the screenshot from comment 4, Dolphin is still not showing the metadata.
I attached the screenshot for comparison purposes.
Comment 8 Méven Car 2019-04-20 15:11:40 UTC
I didn't get that was about the detail view column in the first place.
Thank you for correcting me.
Comment 9 Stefan Brüns 2019-04-28 19:35:54 UTC
(In reply to Méven Car from comment #8)
> I didn't get that was about the detail view column in the first place.
> Thank you for correcting me.

Me neither ...

@Patrick - next time, please be more specific.
Comment 10 Méven Car 2019-05-09 13:42:37 UTC
I did some investigation to fix this.

The limitation is currently in kbaloorolesprovider 
In QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& file,
[...]
// The baloo roles provider calls :
    QMapIterator<KFileMetaData::Property::Property, QVariant> it(file.properties());

But has no other patch when baloo does not respond anything.
Contrary to the InformationPanel that uses baloo-widgets FileMetaDataWidget widget that uses FileMetaDataProvider that uses IndexedDataRetriever when baloo has not find metadata.
However IndexedDataRetriever calls directly the executable baloo_filemetadata_temp_extractor in a process to retrieve metadata for a file, and this is not a great idea to reuse the IndexedDataRetriever in a loop as the detail view needs, since for each file a process would need to get spawned, creating some overhead.
And the dolphin view is filled synchronously in KFileItemModelRolesUpdater, making the UI freeze when the metadata are retrieved.

So the solution would be either reuse IndexedDataRetriever for the detail view and pay the price, or implement an API in Baloo to call do what baloo_filemetadata_temp_extractor does asynchronously and make dolphin able to load metadata asynchronously.
Comment 11 spiesant 2020-05-27 08:54:51 UTC
(In reply to Nate Graham from comment #1)
> Probably it should just index NTFS disks...

I'm facing the same issue as the OP, & am definitely not after a solution of indexing NTFS disks. Being able to view media columns on removable USB drives, SD cards, network drives, etc is also important - & those shouldn't be indexed.  In my case, I actually have indexing disabled entirely, as I don't use search & thus don't need the overhead.  But losing those columns when moving over from Nemo (which supports them via extension) definitely felt like a bit of a regression.
Comment 12 Méven Car 2020-11-01 15:04:26 UTC
(In reply to Méven Car from comment #10)
> I did some investigation to fix this.
> 
> The limitation is currently in kbaloorolesprovider 
> In QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const
> Baloo::File& file,
> [...]
> // The baloo roles provider calls :
>     QMapIterator<KFileMetaData::Property::Property, QVariant>
> it(file.properties());
> 
> But has no other patch when baloo does not respond anything.
> Contrary to the InformationPanel that uses baloo-widgets FileMetaDataWidget
> widget that uses FileMetaDataProvider that uses IndexedDataRetriever when
> baloo has not find metadata.
> However IndexedDataRetriever calls directly the executable
> baloo_filemetadata_temp_extractor in a process to retrieve metadata for a
> file, and this is not a great idea to reuse the IndexedDataRetriever in a
> loop as the detail view needs, since for each file a process would need to
> get spawned, creating some overhead.
> And the dolphin view is filled synchronously in KFileItemModelRolesUpdater,
> making the UI freeze when the metadata are retrieved.
> 
> So the solution would be either reuse IndexedDataRetriever for the detail
> view and pay the price, or implement an API in Baloo to call do what
> baloo_filemetadata_temp_extractor does asynchronously and make dolphin able
> to load metadata asynchronously.

`baloo_filemetadata_temp_extractor` is in `extractor.cpp` whose code could be turned into a KJob, that dolphin could use.
Comment 13 Méven Car 2020-11-01 15:08:52 UTC
*** Bug 426154 has been marked as a duplicate of this bug. ***
Comment 14 Nate Graham 2020-12-02 15:18:30 UTC
*** Bug 429740 has been marked as a duplicate of this bug. ***
Comment 15 Bug Janitor Service 2021-01-10 07:45:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/157
Comment 16 tagwerk19 2021-01-10 09:57:57 UTC
(In reply to Metal450 from comment #11)

> ... those shouldn't be indexed.

You could possibly imagine a future where an index is built and held on the remote/removeable filesystem and is queried when that filesystem is online? Remote/removeable systems have their own wastebaskets, could they not have their own indexes?

Not seriously suggesting that this is on anyone's workplan. But, wouldn't that future be nice?
Comment 17 spiesant 2021-03-13 04:33:51 UTC
(In reply to tagwerk19 from comment #16)
> (In reply to Metal450 from comment #11)
> 
> > ... those shouldn't be indexed.
> 
> You could possibly imagine a future where an index is built and held on the
> remote/removeable filesystem and is queried when that filesystem is online?
> Remote/removeable systems have their own wastebaskets, could they not have
> their own indexes?
> 
> Not seriously suggesting that this is on anyone's workplan. But, wouldn't
> that future be nice?

That wouldn't be my preference.  Far better if metadata just worked without needing to store indexes everywhere (as it does on Windows).  It does take a second or two for large directories to populate all the meta fields, but I'd much rather wait ~2 seconds than have indexes all over the place.
Comment 18 tagwerk19 2021-03-18 17:12:39 UTC
(In reply to Patrick Silva from comment #0)
> It would be very nice if Dolphin could show metadata of non-indexed files
> too.
Having looked at Bug 434565

If baloo is enabled, as per 
    Indexing-Enabled=true
in baloofilerc, then dolphin displays the tags, ratings, comment (xattr metadata) read from the filesystem

With
    Indexing-Enabled=false
dolphin doesn't display the attributes.

    Neon Testing
    Dolphin : 20.12.3
    Plasma : 5.21.3
    Frameworks : 5.81.0
Comment 19 Méven Car 2021-03-27 09:50:52 UTC
(In reply to tagwerk19 from comment #18)
> (In reply to Patrick Silva from comment #0)
> > It would be very nice if Dolphin could show metadata of non-indexed files
> > too.
> Having looked at Bug 434565
> 
> If baloo is enabled, as per 
>     Indexing-Enabled=true
> in baloofilerc, then dolphin displays the tags, ratings, comment (xattr
> metadata) read from the filesystem
> 
> With
>     Indexing-Enabled=false
> dolphin doesn't display the attributes.
> 

Indeed it depends on baloo metadata indexing currently.

But it does not support path not indexed by baloo such as external drives.
Also we can implement this without baloo as a fallback.

My patch suite https://invent.kde.org/system/dolphin/-/merge_requests/157 stuck in review limbo does that.
Comment 20 tagwerk19 2021-11-16 17:04:56 UTC
*** Bug 445067 has been marked as a duplicate of this bug. ***
Comment 21 tagwerk19 2021-12-06 20:25:45 UTC
(In reply to Nate Graham from comment #1)
> Probably it should just index NTFS disks...
As a marker...

Tested a Fedora 35 system with the new Paragon ntfs3 driver. I created an NTFS drive with KDE Partition manager and attached as "/home2" (that is, listed in /etc/fstab with some "magic dust" for selinux).

I was able to create a user on that filesystem, copy files across, see that they were being picked up and indexed (with balooctl monitor), tag them, add a "tags" column in Dolphin and jump back and forth between the "tag folders". I think that's not so bad...

This is very much a "Toe In The Water" test but there's no immediate evidence of calamity (device numbers and inodes _do_ seem stable and the baloo index is living on the same drive). However I don't know enough to say whether ntfs3 is stable and when you could trust it with real data.

The Magic Dust I used was:

    UUID=XXXXXXXXXXXXXXXX   /home2   ntfs3   rw,relatime,context="system_u:object_r:home_root_t:s0" 0 0
Comment 22 Bug Janitor Service 2022-01-22 10:07:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kio-extras/-/merge_requests/141
Comment 23 Patrick Silva 2024-02-17 00:18:48 UTC
*** Bug 481420 has been marked as a duplicate of this bug. ***
Comment 24 Méven 2024-11-02 13:35:21 UTC
*** Bug 495592 has been marked as a duplicate of this bug. ***