Skip to content
Snippets Groups Projects
Commit 5287e7f9 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Fix external devices detection

(cherry picked from commit a4163ba89ad299b39628df889a7de9f8e737023b)
parent 6c981992
No related branches found
No related tags found
No related merge requests found
Pipeline #7152 passed with stage
in 3 minutes and 42 seconds
......@@ -130,7 +130,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope {
ACTION_FORCE_RELOAD -> actions.offer(ForceReload)
ACTION_DISCOVER -> discover(intent.getStringExtra(EXTRA_PATH))
ACTION_DISCOVER_DEVICE -> discoverStorage(intent.getStringExtra(EXTRA_PATH))
ACTION_CHECK_STORAGES -> if (scanActivated) actions.offer(UpdateStorages) else exitCommand()
ACTION_CHECK_STORAGES -> if (settings.getInt(KEY_MEDIALIBRARY_SCAN, -1) != ML_SCAN_OFF) actions.offer(UpdateStorages) else exitCommand()
else -> {
exitCommand()
return Service.START_NOT_STICKY
......@@ -248,11 +248,9 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope {
private suspend fun updateStorages() {
serviceLock = true
val ctx = applicationContext
val (sharedPreferences, devices, knownDevices) = withContext(Dispatchers.IO) {
val sharedPreferences = Settings.getInstance(ctx)
val (devices, knownDevices) = withContext(Dispatchers.IO) {
val devices = AndroidDevices.getExternalStorageDirectories()
Triple(sharedPreferences, devices, medialibrary.devices)
Pair(devices, medialibrary.devices)
}
val missingDevices = Util.arrayToArrayList(knownDevices)
missingDevices.remove("file://${AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment