Commit 22b4d070 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Hugo Beauzée-Luyssen

MediaLibrary: Add a function to refresh all devices

Regardless of a specific fs factory, as we might not have the fs factory
that was present to handle some devices that are still in database
parent 1271d539
......@@ -2113,6 +2113,16 @@ void MediaLibrary::refreshDevices( fs::IFileSystemFactory& fsFactory )
LOG_DEBUG( "Done refreshing devices in database." );
void MediaLibrary::refreshDevices()
auto devices = Device::fetchAll( this );
for ( const auto& d : devices )
auto fsFactory = fsFactoryForMrl( d->scheme() );
refreshDevice( *d, fsFactory.get() );
bool MediaLibrary::forceRescan()
if ( m_parser != nullptr )
......@@ -193,7 +193,25 @@ public:
virtual IDeviceListerCb* setDeviceLister( DeviceListerPtr lister ) override;
std::shared_ptr<fs::IFileSystemFactory> fsFactoryForMrl( const std::string& path ) const;
* @brief refreshDevices Refreshes the devices from a specific FS factory
* @param fsFactory The file system factory for which devices must be refreshed
* This is expected to be used when a specific factory signals that a device
* was plugged/unplugged.
void refreshDevices(fs::IFileSystemFactory& fsFactory);
* @brief refreshDevices Refreshes all known devices
* This will refresh the presence & last seen date for all known devices we
* have in database.
* This operation must not be based on the available FsFactories, as we might
* not have a factory that was used to create a device before (for instance
* if we restart with network discovery disabled)
* We still need to mark all the associated devices as missing.
void refreshDevices();
virtual bool forceRescan() override;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment