Add mounted-only option to 'list' and 'devices' command
Use a common function to determine if a device should be ignored
Depends on D11753
Baloo | |
Frameworks |
Add mounted-only option to 'list' and 'devices' command
Use a common function to determine if a device should be ignored
Depends on D11753
No Linters Available |
No Unit Test Coverage |
src/tools/experimental/baloodb/main.cpp | ||
---|---|---|
160 | Ideas for better formatting this are welcome. |
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
304–305 | If ignoredDevices is a Set/List, you can do a filter pass over the fileList first. auto& fileList = listResult.first; auto tail = fileList.end(); for (auto deviceId : ignoredDevices) { tail = std::remove_if(fileList.begin(), tail, [deviceId] (const FileInfo& info) { return info.id == deviceId; }); } summary.ignored += fileList.end() - tail; std::erase(tail, fileList.end()); |
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
304–305 | Cool! |
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
180 | How can this work? quint64 + bool |
I went I little overboard with remove_if and had to repair.
Device filtering is also broken see inline comment.
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
160 | $ baloodb list --mounted-only Einstein Listing database contents... ! device: 43 inode: 319 url: /media/circulans/(tv-analog)/L-Z/Was Einstein noch nicht wusste.mkv + device: 46 inode: 319 url: /media/circulans/(doku)/Was Einstein noch nicht wusste.mkv 43 is the correct id for a share. The path is wrong. QStorageInfo is not enough, I'm afraid. For proper matching mtab must be read. |
src/engine/experimental/databasesanitizer.cpp | ||
---|---|---|
179 | isMounted(id) can be implemented as getStorageInfo(id).isValid() | |
183 | unused, please remove | |
215 | I can not see what this function is useful for. Just inline the FileInfo -> DeviceIds reduction here, and ... | |
218 | ... skip the deviceId if it should be ignored: const auto storageInfo = getStorageInfo(id); if (isDeviceIgnored(storageInfo, accessFilter)) { continue; } | |
221 | if (info.deviceId != deviceId) { return false; } summary.accessible += info.accessible ? 1 : 0; return true; |
I'm sorry for making so much noise with all those stupid mistakes. It's probably best for me to let this rest for a few days, relax a little and gain some distance.
@bruns this still applies cleanly to current master, do you think this and the dependent revision are still worth it to merge?