Skip to content
Snippets Groups Projects
Commit 8512cc9c authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Update medialibrary hash

parent de548552
No related branches found
No related tags found
1 merge request!820Update ml
......@@ -32,7 +32,7 @@ import android.content.IntentFilter
import android.hardware.usb.UsbDevice
import android.hardware.usb.UsbManager
import android.net.Uri
import androidx.core.content.ContextCompat
import android.util.Log
import androidx.core.content.getSystemService
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
......@@ -70,6 +70,7 @@ object ExternalMonitor : BroadcastReceiver(), LifecycleObserver, CoroutineScope
for (action in channel) when (action){
is MediaMounted -> {
if (action.uuid.isEmpty()) return@actor
Log.i("ExternalMonitor", "Storage management: mount: ${action.uuid} - ${action.path}")
val isNew = ctx.getFromMl {
val isNewForMl = !isDeviceKnown(action.uuid, action.path, true)
addDevice(action.uuid, action.path, true)
......@@ -79,6 +80,7 @@ object ExternalMonitor : BroadcastReceiver(), LifecycleObserver, CoroutineScope
}
is MediaUnmounted -> {
delay(100L)
Log.i("ExternalMonitor", "Storage management: unmount: ${action.uuid} - ${action.path}")
Medialibrary.getInstance().removeDevice(action.uuid, action.path)
storageChannel.safeOffer(action)
}
......
......@@ -331,6 +331,7 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb {
}
withContext(Dispatchers.IO) { for (device in missingDevices) {
val uri = device.toUri()
Log.i("MediaParsingService", "Storage management: storage missing: ${uri.path}")
medialibrary.removeDevice(uri.lastPathSegment, uri.path)
} }
serviceLock = false
......
......@@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.util.Log
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.delay
......@@ -33,6 +34,7 @@ class StoragesMonitor : BroadcastReceiver() {
for (action in channel) when (action){
is Mount -> {
if (action.uuid.isEmpty()) return@actor
Log.i("StoragesMonitor", "Storage management: mount: ${action.uuid} - ${action.path}")
if (action.path.scanAllowed()) {
val isNew = action.ctx.getFromMl {
val isNewForML = !isDeviceKnown(action.uuid, action.path, true)
......@@ -52,6 +54,7 @@ class StoragesMonitor : BroadcastReceiver() {
}
}
is Unmount -> {
Log.i("StoragesMonitor", "Storage management: unmount: ${action.uuid} - ${action.path}")
delay(100L)
Medialibrary.getInstance().removeDevice(action.uuid, action.path)
}
......
......@@ -4,7 +4,7 @@
# ARGUMENTS #
#############
MEDIALIBRARY_HASH=1755e7abfa80f53129050c9d39f5494025a9a854
MEDIALIBRARY_HASH=8bb0bfb4b4db9587bead04dd69c930a4f155fcda
while [ $# -gt 0 ]; do
case $1 in
......
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