Skip to content

feat: Copy downloaded music to public Music folder#2878

Open
vampirepapi wants to merge 9 commits intoMetrolistGroup:mainfrom
vampirepapi:main
Open

feat: Copy downloaded music to public Music folder#2878
vampirepapi wants to merge 9 commits intoMetrolistGroup:mainfrom
vampirepapi:main

Conversation

@vampirepapi
Copy link

Summary

  • When a song download completes, automatically copies the audio file to Music/Metrolist/ in public storage so users can access downloaded songs from
    any file manager or music player
  • Uses MediaStore API on Android 10+ (no extra permissions needed) and direct file I/O with WRITE_EXTERNAL_STORAGE on Android 8-9
  • Exports as .m4a format for maximum device compatibility (including smartwatches)
  • ExoPlayer's internal download cache remains untouched — playback continues working as-is

Changes

  • AndroidManifest.xml — Added WRITE_EXTERNAL_STORAGE permission (maxSdkVersion=28)
  • DownloadUtil.kt — On STATE_COMPLETED, fetches song metadata and triggers export
  • MusicFileExporter.kt (new) — Utility that reads cached audio via CacheDataSource and writes to public Music folder. Handles filename
    sanitization, duplicate overwrite, and toast notifications
  • build_quick.yml — Build workflow improvements for debug APK generation

Test plan

  • Download a song from within the app
  • Open file manager → navigate to Internal Storage > Music > Metrolist
  • Verify the .m4a file exists with correct Artist - Title.m4a naming
  • Verify the file is playable in an external music player
  • Verify re-downloading the same song overwrites the existing file
  • Test on Android 10+ device (MediaStore path)
  • Test on Android 9 device if available (direct file path)

vampirepapi and others added 9 commits February 16, 2026 17:11
When a download completes, the cached audio is now exported to
the public Music/Metrolist/ directory so users can access files
via file managers and other music apps. Uses MediaStore API on
Android 10+ and direct file I/O on Android 8-9.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Upload unsigned APK directly instead of requiring signing secrets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unsigned release APKs cannot be installed. Switch to debug build
which is auto-signed with the debug keystore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The debug build requires a persistent-debug.keystore file.
Generate one on the fly using keytool.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reading span files directly may not work reliably. Switch to
CacheDataSource which properly reads cached data through the
ExoPlayer cache API. Added logging for debugging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show a toast on success (with file path) or failure (with error
message) so the user can see what's happening without logcat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MediaStore rejects audio/webm as unsupported. Map it to audio/ogg
which is accepted and compatible (WebM audio uses Opus/Vorbis codecs).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e extensions

When audio/webm was converted to audio/ogg for MediaStore, the filename
still used .webm extension, causing MediaStore to append .oga resulting
in .webm.oga files. Now the extension is derived after MIME type
conversion so the filename matches what MediaStore expects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Always use audio/mp4 MIME type and .m4a extension for exported files,
ensuring compatibility with Samsung smartwatches and other devices
that don't support .ogg/.webm formats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thatfrog12
Copy link

Duplicate of #119?

@mostafaalagamy mostafaalagamy changed the base branch from master to main February 18, 2026 22:50
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.

2 participants