Skip to content

fix(audio): show .opus and other unindexed audio in the Audio tab - #202

Open
Aryan447 wants to merge 2 commits into
mainfrom
issue-194
Open

Aryan447 wants to merge 2 commits into
mainfrom
issue-194

Conversation

@Aryan447

@Aryan447 Aryan447 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • The Audio tab no longer depends on MediaStore.Audio alone. It now merges the audio table, the files table, and a bounded filesystem fallback, deduplicated by path.
  • Files the scanner indexed but did not classify — including .opus downloads under folders like Download/YTDLnis/Audio — are detected by MIME type and every supported audio extension.
  • hasAudio() uses the same fallback chain, so the tab is no longer hidden when the media database reports zero audio rows.
  • Untagged fallback tracks use their parent folder as the album, and missing durations are filled with MediaInfo using four permits.
  • The presence probe now runs only when the Audio tab is enabled in settings.

Closes #194.

Before / After

Behavior Before After
.opus library only in MediaStore.Files Audio tab hidden, zero tracks Audio tab visible, tracks listed
Audio files skipped by the scanner entirely Audio tab hidden, zero tracks Found by bounded filesystem fallback
Untagged fallback tracks Unknown Album with 0s duration Grouped by parent folder, duration via MediaInfo
Probe when Audio tab is disabled Always ran at startup Skipped

Verification

  • ./gradlew :app:compileStandardDebugKotlin --offline
  • ./gradlew :app:testStandardDebugUnitTest --offline
  • git diff --check
  • Device check — no Android device attached to this machine, so the fallback was not exercised on hardware.

No performance numbers are claimed; scan timing was not measured.

Changelog

UNRELEASED.md → Fixed: "Audio files Android's media scanner skips, including .opus downloads, now appear in the Audio tab."

Risks

  • The filesystem fallback walks storage at most 10 levels deep, skips hidden/system/cache folders, and caches a negative presence result for 60 seconds. It only runs when the media database has no audio at all.
  • On devices that reject the audio columns on the files table, the query retries with a basic projection and falls back to filename/mime metadata.

Summary by Sourcery

Make audio discovery resilient to incomplete media indexing so supported files consistently appear in the Audio tab.

New Features:

  • Include audio files missed by Android’s media scanner, including unclassified formats such as .opus, in the Audio tab.

Bug Fixes:

  • Prevent the Audio tab from being hidden when audio exists outside the primary media database classification.
  • Populate missing fallback-track durations and group untagged tracks by their parent folder.

Enhancements:

  • Merge and deduplicate audio discovered across audio media records, the files table, and a bounded filesystem fallback.
  • Only perform audio presence detection when the Audio tab is enabled.

Documentation:

  • Document the fix for scanner-skipped audio files in the unreleased changelog.

Chores:

  • Add the version 10 Room database schema snapshot.

Android's media scanner can index .opus files under the files table without
classifying them as audio on some OEM skins, so MediaStore.Audio returned zero
rows and the Audio tab stayed hidden even though playback worked.

Merge MediaStore.Audio, MediaStore.Files (audio MIME types plus every supported
audio extension), and a bounded filesystem fallback. Files-table rows without
tags use their parent folder as the album, and missing durations are filled
with MediaInfo using four permits.

Verification: :app:compileStandardDebugKotlin and
:app:testStandardDebugUnitTest (offline), git diff --check.
@sourcery-ai

sourcery-ai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Schema and migrations

The schema snapshot records the database schema associated with this change.

  • app/schemas/app.aryan447.mpvium.database.MpviumDatabase/10.json L1-737

Implementation

The audio scan utilities merge MediaStore sources and a bounded filesystem fallback, detect audio, construct tracks, and enrich missing durations.

  • app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt L14-24, L37-168, L225-574 (+1 small edits)

UI

The main screen runs the audio-presence probe only when the Audio tab is enabled.

  • app/src/main/java/app/aryan447/mpvium/ui/browser/MainScreen.kt L210-216

Documentation

The unreleased changelog announces that audio files skipped by Android's media scanner now appear in the Audio tab.

  • UNRELEASED.md L21

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T13:12:23.868310Z 9705df9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mpvium with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9705df9
Status: ✅  Deploy successful!
Preview URL: https://17619b93.mpvium.pages.dev
Branch Preview URL: https://issue-194.mpvium.pages.dev

View logs

@sourcery-ai

sourcery-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 9705df9

#194 feat: Detect audio files (opus) · 0 of 1 met · 1 to check by hand

# Requirement Status Notes
1 Autodetect audio files, including Opus 👀 Check by hand (runtime) The code checks MediaStore.Audio, MediaStore.Files by MIME type and supported extension, and a bounded filesystem fallback; verify on an Android device that an unindexed Opus file is detected and appears in the Audio tab.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 10 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="163" />
<code_context>
-      Log.e(TAG, "Error scanning MediaStore for audio", e)
+    scanAudioFromMediaStore(context, tracksByPath)
+    scanAudioFromMediaStoreFiles(context, tracksByPath)
+    if (tracksByPath.isEmpty()) {
+      scanAudioFromFileSystem(context, tracksByPath)
     }
</code_context>
<issue_to_address>
**Unindexed audio stays missing**

When mediaStore contains at least one audio track and another supported audio file is absent from its queried tables, `scanAudio` runs `scanAudioFromFileSystem` only when `tracksByPath` is empty, so any indexed track suppresses the fallback and the unindexed file stays out of the Audio tab.

Run `scanAudioFromFileSystem` alongside the MediaStore scans and deduplicate the resulting tracks.

Also at `UNRELEASED.md:21`.
</issue_to_address>

### Comment 2
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="266-269" />
<code_context>
+      ?: queryFilesTable(context, FILES_BASIC_PROJECTION)
+      ?: return
+
+    cursor.use {
+      val columns = TrackColumns(it)
+      while (it.moveToNext()) {
+        val track = buildTrack(
+          cursor = it,
+          columns = columns,
</code_context>
<issue_to_address>
**Audio library fails to load**

When the files-table provider returns a cursor but throws while advancing it, reading a row, or building a track, `scanAudioFromMediaStoreFiles` lets the exception escape, so `scanAudio` stops before it can return collected tracks or run the filesystem fallback, and the Audio library fails to load.

Catch errors while consuming the files-table cursor so the scan can retain available tracks and continue.
</issue_to_address>

### Comment 3
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="500" />
<code_context>
+    val album = file.parentFile?.name?.takeIf { it.isNotBlank() } ?: "Unknown Album"
+
+    return LocalAudioTrack(
+      id = file.absolutePath.hashCode().toLong(),
+      title = file.nameWithoutExtension,
+      displayName = file.name,
</code_context>
<issue_to_address>
**Audio list keys collide**

When the filesystem fallback finds two distinct files whose absolute paths have the same Java string hash, `buildTrackFromFile` uses the path hash as `id`, so both tracks receive the same lazy-list key and Compose throws instead of displaying them.

Assign fallback tracks IDs that are unique for distinct files rather than using only the path hash.
</issue_to_address>

### Comment 4
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="167" />
<code_context>
+      scanAudioFromFileSystem(context, tracksByPath)
     }

+    val tracks = enrichMissingDurations(context, tracksByPath.values.toList())
+
     // Group into albums (ID from album + artist, never from title alone)
</code_context>
<issue_to_address>
**Older scans overwrite newer library**

When two refreshes overlap, a newer one finishes before an older scan, the older `AudioRepository.refresh()` finishes last and replaces `_libraryData` with its earlier scan result, even after a newer refresh has already published current tracks; the Audio tab then shows stale library contents until another refresh.

Serialize audio scans or publish results only when their refresh generation is still current.
</issue_to_address>

### Comment 5
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="394" />
<code_context>
+  }
+
+  private fun trackKey(track: LocalAudioTrack): String =
+    track.path.ifBlank { "${track.displayName}|${track.size}" }
+
+  // ==========================================================================
</code_context>
<issue_to_address>
**Distinct tracks are discarded**

When two distinct tracks have blank paths and identical display names and sizes, `trackKey` gives both tracks the same `displayName|size` key, so `putIfAbsent` discards the later track and the library omits it.

Use a key that distinguishes distinct pathless tracks.
</issue_to_address>

### Comment 6
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="515" />
<code_context>
+      size = size,
+      sizeFormatted = VideoScanUtils.formatFileSize(size),
+      path = file.absolutePath,
+      uri = Uri.fromFile(file),
+      albumArtUri = null,
+      mimeType = FileTypeUtils.getAudioMimeTypeFromExtension(extension),
</code_context>
<issue_to_address>
**Fallback durations stay zero**

When a filesystem-only track has no indexed duration, `enrichMissingDurations` passes the `file://` URI from `buildTrackFromFile` to `MediaInfoOps.extractBasicMetadata`, which opens it with `ContentResolver.openFileDescriptor`; that lookup fails and the track keeps duration `0`.

Read filesystem-only track metadata from the file path or another URI form supported by the metadata reader.

Also at `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:567`.
</issue_to_address>

### Comment 7
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="287" />
<code_context>
+    context.contentResolver.query(
+      FILES_URI,
+      projection,
+      AUDIO_FILES_SELECTION,
+      null,
+      "${MediaStore.Files.FileColumns.DISPLAY_NAME} ASC",
</code_context>
<issue_to_address>
**Hidden audio rows enter library**

When `MediaStore.Files` contains a supported audio row under a hidden, skipped, or `.nomedia` folder, `queryFilesTable` selects matching MIME types and extensions without applying the hidden-folder or `.nomedia` exclusions used by the filesystem walk, so matching rows already present in `MediaStore.Files` are added to the visible library.

Apply the same exclusion policy to files-table results before adding tracks.
</issue_to_address>

### Comment 8
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="406" />
<code_context>
+      return fileSystemProbeResult
+    }
+
+    val found = audioSearchRoots(context).any { containsAudioFile(it, 0) }
+    fileSystemProbeTime = now
+    fileSystemProbeResult = found
</code_context>
<issue_to_address>
**Hidden audio gets exposed**

When a common search-root directory such as Music or Downloads contains `.nomedia` and audio files directly inside it, `containsAudioFile` and `collectAudioFiles` apply `shouldSkipFolder` only to child directories, not to the roots passed in; audio directly inside a root containing `.nomedia` is therefore reported by the probe and added to the Audio tab.

Check whether each search root should be skipped before probing or collecting its contents.

Also at `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:438`.
</issue_to_address>

### Comment 9
<location path="app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt" line_range="486" />
<code_context>
+    }
+
+    // Then the whole volume, so audio in custom folders is not missed.
+    paths.add(primaryStorage.absolutePath)
+    for (volume in StorageVolumeUtils.getExternalStorageVolumes(context)) {
+      StorageVolumeUtils.getVolumePath(volume)?.let { paths.add(it) }
</code_context>
<issue_to_address>
**Audio probe walks the whole volume**

When mediaStore has no audio rows and the common directories do not contain an audio file, `audioSearchRoots` includes the primary storage root, and `containsAudioFile` recursively traverses its directories. When MediaStore has no audio and the early directories contain none, the presence check enumerates the entire accessible volume up to the depth limit, delaying the Audio tab decision on devices with large storage trees.

Bound the probe by elapsed time or number of visited entries, or restrict it to likely media locations instead of recursively walking the whole volume.

Also at `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:423`.
</issue_to_address>

### Comment 10
<location path="UNRELEASED.md" line_range="21" />
<code_context>

 ### Fixed

+- Audio files Android's media scanner skips, including `.opus` downloads, now appear in the Audio tab.
 - Modern player layout custom action buttons scale consistently with built-in controls.
 - Shader peek upscale chip no longer covers top-right player buttons when smart skip is absent.
</code_context>
<issue_to_address>
**Release notes omit audio fix**

When this user-visible behavior change is prepared for release, `CHANGELOG.md` is not updated, so the user-facing release notes omit this audio-tab fix.

Add the audio-tab fix to `CHANGELOG.md` alongside the unreleased note.
</issue_to_address>

Sourcery assessment

Approval pending. 9 findings to address first.

Blocking findings: app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:163, app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:269, app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:500, app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:167, app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:394, and 4 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Log.e(TAG, "Error scanning MediaStore for audio", e)
scanAudioFromMediaStore(context, tracksByPath)
scanAudioFromMediaStoreFiles(context, tracksByPath)
if (tracksByPath.isEmpty()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Unindexed audio stays missing

When mediaStore contains at least one audio track and another supported audio file is absent from its queried tables, scanAudio runs scanAudioFromFileSystem only when tracksByPath is empty, so any indexed track suppresses the fallback and the unindexed file stays out of the Audio tab.

Run scanAudioFromFileSystem alongside the MediaStore scans and deduplicate the resulting tracks.

Also at UNRELEASED.md:21.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 163:

**Unindexed audio stays missing**

When mediaStore contains at least one audio track and another supported audio file is absent from its queried tables, `scanAudio` runs `scanAudioFromFileSystem` only when `tracksByPath` is empty, so any indexed track suppresses the fallback and the unindexed file stays out of the Audio tab.

Run `scanAudioFromFileSystem` alongside the MediaStore scans and deduplicate the resulting tracks.

Also at `UNRELEASED.md:21`.

From AGENTS.md L224-225:

- Every claim must be true and, where possible, measurable. Never say
  "faster" without saying what got faster.

Comment on lines +266 to +269
cursor.use {
val columns = TrackColumns(it)
while (it.moveToNext()) {
val track = buildTrack(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Audio library fails to load

When the files-table provider returns a cursor but throws while advancing it, reading a row, or building a track, scanAudioFromMediaStoreFiles lets the exception escape, so scanAudio stops before it can return collected tracks or run the filesystem fallback, and the Audio library fails to load.

Catch errors while consuming the files-table cursor so the scan can retain available tracks and continue.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at lines 266-269:

**Audio library fails to load**

When the files-table provider returns a cursor but throws while advancing it, reading a row, or building a track, `scanAudioFromMediaStoreFiles` lets the exception escape, so `scanAudio` stops before it can return collected tracks or run the filesystem fallback, and the Audio library fails to load.

Catch errors while consuming the files-table cursor so the scan can retain available tracks and continue.

val album = file.parentFile?.name?.takeIf { it.isNotBlank() } ?: "Unknown Album"

return LocalAudioTrack(
id = file.absolutePath.hashCode().toLong(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Audio list keys collide

When the filesystem fallback finds two distinct files whose absolute paths have the same Java string hash, buildTrackFromFile uses the path hash as id, so both tracks receive the same lazy-list key and Compose throws instead of displaying them.

Assign fallback tracks IDs that are unique for distinct files rather than using only the path hash.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 500:

**Audio list keys collide**

When the filesystem fallback finds two distinct files whose absolute paths have the same Java string hash, `buildTrackFromFile` uses the path hash as `id`, so both tracks receive the same lazy-list key and Compose throws instead of displaying them.

Assign fallback tracks IDs that are unique for distinct files rather than using only the path hash.

scanAudioFromFileSystem(context, tracksByPath)
}

val tracks = enrichMissingDurations(context, tracksByPath.values.toList())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Older scans overwrite newer library

When two refreshes overlap, a newer one finishes before an older scan, the older AudioRepository.refresh() finishes last and replaces _libraryData with its earlier scan result, even after a newer refresh has already published current tracks; the Audio tab then shows stale library contents until another refresh.

Serialize audio scans or publish results only when their refresh generation is still current.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 167:

**Older scans overwrite newer library**

When two refreshes overlap, a newer one finishes before an older scan, the older `AudioRepository.refresh()` finishes last and replaces `_libraryData` with its earlier scan result, even after a newer refresh has already published current tracks; the Audio tab then shows stale library contents until another refresh.

Serialize audio scans or publish results only when their refresh generation is still current.

}

private fun trackKey(track: LocalAudioTrack): String =
track.path.ifBlank { "${track.displayName}|${track.size}" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Distinct tracks are discarded

When two distinct tracks have blank paths and identical display names and sizes, trackKey gives both tracks the same displayName|size key, so putIfAbsent discards the later track and the library omits it.

Use a key that distinguishes distinct pathless tracks.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 394:

**Distinct tracks are discarded**

When two distinct tracks have blank paths and identical display names and sizes, `trackKey` gives both tracks the same `displayName|size` key, so `putIfAbsent` discards the later track and the library omits it.

Use a key that distinguishes distinct pathless tracks.

size = size,
sizeFormatted = VideoScanUtils.formatFileSize(size),
path = file.absolutePath,
uri = Uri.fromFile(file),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Fallback durations stay zero

When a filesystem-only track has no indexed duration, enrichMissingDurations passes the file:// URI from buildTrackFromFile to MediaInfoOps.extractBasicMetadata, which opens it with ContentResolver.openFileDescriptor; that lookup fails and the track keeps duration 0.

Read filesystem-only track metadata from the file path or another URI form supported by the metadata reader.

Also at app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:567.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 515:

**Fallback durations stay zero**

When a filesystem-only track has no indexed duration, `enrichMissingDurations` passes the `file://` URI from `buildTrackFromFile` to `MediaInfoOps.extractBasicMetadata`, which opens it with `ContentResolver.openFileDescriptor`; that lookup fails and the track keeps duration `0`.

Read filesystem-only track metadata from the file path or another URI form supported by the metadata reader.

Also at `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:567`.

context.contentResolver.query(
FILES_URI,
projection,
AUDIO_FILES_SELECTION,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Hidden audio rows enter library

When MediaStore.Files contains a supported audio row under a hidden, skipped, or .nomedia folder, queryFilesTable selects matching MIME types and extensions without applying the hidden-folder or .nomedia exclusions used by the filesystem walk, so matching rows already present in MediaStore.Files are added to the visible library.

Apply the same exclusion policy to files-table results before adding tracks.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 287:

**Hidden audio rows enter library**

When `MediaStore.Files` contains a supported audio row under a hidden, skipped, or `.nomedia` folder, `queryFilesTable` selects matching MIME types and extensions without applying the hidden-folder or `.nomedia` exclusions used by the filesystem walk, so matching rows already present in `MediaStore.Files` are added to the visible library.

Apply the same exclusion policy to files-table results before adding tracks.

return fileSystemProbeResult
}

val found = audioSearchRoots(context).any { containsAudioFile(it, 0) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Hidden audio gets exposed

When a common search-root directory such as Music or Downloads contains .nomedia and audio files directly inside it, containsAudioFile and collectAudioFiles apply shouldSkipFolder only to child directories, not to the roots passed in; audio directly inside a root containing .nomedia is therefore reported by the probe and added to the Audio tab.

Check whether each search root should be skipped before probing or collecting its contents.

Also at app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:438.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 406:

**Hidden audio gets exposed**

When a common search-root directory such as Music or Downloads contains `.nomedia` and audio files directly inside it, `containsAudioFile` and `collectAudioFiles` apply `shouldSkipFolder` only to child directories, not to the roots passed in; audio directly inside a root containing `.nomedia` is therefore reported by the probe and added to the Audio tab.

Check whether each search root should be skipped before probing or collecting its contents.

Also at `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:438`.

}

// Then the whole volume, so audio in custom folders is not missed.
paths.add(primaryStorage.absolutePath)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Audio probe walks the whole volume

When mediaStore has no audio rows and the common directories do not contain an audio file, audioSearchRoots includes the primary storage root, and containsAudioFile recursively traverses its directories. When MediaStore has no audio and the early directories contain none, the presence check enumerates the entire accessible volume up to the depth limit, delaying the Audio tab decision on devices with large storage trees.

Bound the probe by elapsed time or number of visited entries, or restrict it to likely media locations instead of recursively walking the whole volume.

Also at app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:423.

Prompt for AI agents
In `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt` at line 486:

**Audio probe walks the whole volume**

When mediaStore has no audio rows and the common directories do not contain an audio file, `audioSearchRoots` includes the primary storage root, and `containsAudioFile` recursively traverses its directories. When MediaStore has no audio and the early directories contain none, the presence check enumerates the entire accessible volume up to the depth limit, delaying the Audio tab decision on devices with large storage trees.

Bound the probe by elapsed time or number of visited entries, or restrict it to likely media locations instead of recursively walking the whole volume.

Also at `app/src/main/java/app/aryan447/mpvium/domain/audio/AudioScanUtils.kt:423`.

Comment thread UNRELEASED.md

### Fixed

- Audio files Android's media scanner skips, including `.opus` downloads, now appear in the Audio tab.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Low · Release notes omit audio fix

When this user-visible behavior change is prepared for release, CHANGELOG.md is not updated, so the user-facing release notes omit this audio-tab fix.

Add the audio-tab fix to CHANGELOG.md alongside the unreleased note.

Prompt for AI agents
In `UNRELEASED.md` at line 21:

**Release notes omit audio fix**

When this user-visible behavior change is prepared for release, `CHANGELOG.md` is not updated, so the user-facing release notes omit this audio-tab fix.

Add the audio-tab fix to `CHANGELOG.md` alongside the unreleased note.

From AGENTS.md L229:

- Update both files in the same change that alters user-visible behavior.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Detect audio files (opus)

1 participant