Fix doubled photos: /sdcard is a symlink to /storage/emulated/0
Scanning both paths listed every photo twice. Now only scan /storage/emulated/0/DCIM which is the canonical path.
This commit is contained in:
@@ -27,9 +27,8 @@ class AndroidConnector(
|
|||||||
// Directories on Android that contain camera-roll originals.
|
// Directories on Android that contain camera-roll originals.
|
||||||
// Used as fallback if dynamic DCIM discovery finds nothing.
|
// Used as fallback if dynamic DCIM discovery finds nothing.
|
||||||
private val fallbackCameraDirs = listOf(
|
private val fallbackCameraDirs = listOf(
|
||||||
"/sdcard/DCIM/Camera",
|
"/storage/emulated/0/DCIM/Camera",
|
||||||
"/sdcard/DCIM/100ANDRO",
|
"/storage/emulated/0/Pictures/Camera",
|
||||||
"/sdcard/Pictures/Camera",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Photo/video extensions to include
|
// Photo/video extensions to include
|
||||||
@@ -66,8 +65,9 @@ class AndroidConnector(
|
|||||||
val serial = requireSerial(device)
|
val serial = requireSerial(device)
|
||||||
val photos = mutableListOf<PhonePhoto>()
|
val photos = mutableListOf<PhonePhoto>()
|
||||||
|
|
||||||
// Dynamically discover all subdirectories under DCIM on common storage paths
|
// /sdcard is a symlink to /storage/emulated/0 on most Android devices.
|
||||||
val dcimRoots = listOf("/sdcard/DCIM", "/storage/emulated/0/DCIM")
|
// Scan only /storage/emulated/0/DCIM to avoid listing every photo twice.
|
||||||
|
val dcimRoots = listOf("/storage/emulated/0/DCIM")
|
||||||
val cameraDirs = mutableListOf<String>()
|
val cameraDirs = mutableListOf<String>()
|
||||||
|
|
||||||
for (root in dcimRoots) {
|
for (root in dcimRoots) {
|
||||||
@@ -80,7 +80,6 @@ class AndroidConnector(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Also check Pictures/Camera (some Samsung models store there)
|
// Also check Pictures/Camera (some Samsung models store there)
|
||||||
cameraDirs.add("/sdcard/Pictures/Camera")
|
|
||||||
cameraDirs.add("/storage/emulated/0/Pictures/Camera")
|
cameraDirs.add("/storage/emulated/0/Pictures/Camera")
|
||||||
|
|
||||||
// Fall back to hardcoded list if dynamic discovery found nothing
|
// Fall back to hardcoded list if dynamic discovery found nothing
|
||||||
|
|||||||
Reference in New Issue
Block a user