feat(downloads): add format picker and custom download path#2871
feat(downloads): add format picker and custom download path#2871alltechdev wants to merge 15 commits intomainfrom
Conversation
cc6fadd to
bac1c87
Compare
|
Just saying, guys, feel free to completely ignore this one 😁 I'm aware it's a ridiculous amount of code, I just really like the functionality, especially bento4. |
Can you PLEASE tell me how long it took you to write almost 80k lines of code. I bet it was like hell to debug bugs. |
|
I need to review 80,000 lines!!! 🤣 |
e57f717 to
8a6a5bc
Compare
|
Give this man an award! This is awesome! |
I originally wrote this a while ago for a different app with AI assistance (80000 lines... haha). Just had to port it over. I went slow, piece by piece, and put logging EVERYWHERE 😁. Probably a day or two until I was happy with it. The main thing is making sure it the player doesnt get messed up by URL cache, that's the most annoying bit. Try latest, I pushed a few fixes: https://github.com/MetrolistGroup/Metrolist/actions/runs/22066983334/artifacts/5526986427 |
I was afraid of this. It has a database migration. @mostafaalagamy How can he go back? Gimme a few I have an idea, need backwards compatibility. |
He can only go back after modifying the backup file! |
I will add backwards compatibility for old downloads. |
|
@futurehits3-stack just pushed, wait a few minutes for new build and let me know if solved |
|
@alltechdev I got you. |
|
Nope the fix unfortunately didn't work. Downloading doesn't work also. @alltechdev
|
You mean downloading an already downloaded song with previous builds right? |
|
So if I go to my library tab and go my downloads, everything works. But if I go to my homepage and click on a downloaded song it doesn't works. |
When not playing directly from downloaded in Library tab: Error immediately? And again, only for old downloads, correct? I just tried reproducing the bug. I installed official 13.0.0 debug, downloaded multiple tracks and albums, then installed this PR build on top. All working fine. |
|
@alltechdev did you do something? All the songs on my homepage are working again and I can download songs. The app is back to working without any problems so far.
|
That's latest build. All should be good when updating from old. |
To anybody who will test this build, please backup everything from the old app in case you will want to downgrade again. Thanks. |
|
@alltechdev just updated and everything is working! Good shit my dude. Edit: I didn't try to downgrade to the main app. I'm currently running this latest test build. But, everything is working for me. |
|
@alltechdev I just downgraded to the official release to see what would happen. And I got this error. |
Yep. That's what I was saying before. Would need to clear data of app to downgrade. |
|
@alltechdev uninstalled everything and cleared the cache. Everything works again. I'm currently running the main app. Hopefully we can get your features that you added. The new download option is awesome because I get to keep the songs forever. |
You also get all metadata and coverart embedded automatically if you choose m4a download :) Thanks for testing! |
|
I do want to say if you choose to download the full album it didn't allow me to download.m4a it downloaded .webm. @alltechdev |
You must have not been on latest. Album download: Added here: |
|
On individual songs I got the option to download.m4a but when I go to an album to download all the songs it downloaded .webm and didn't get the option menu. I might redownload later when I have time to check it out if you added it. |
|
Crazy! We can discard "local music" if we add this one? |
Didn't think about that. Is that a wanted feature? Would definitely need some modification. |
Many people request this feature, specially on reddit. Like right now someone just made another post asking about it: https://www.reddit.com/r/metrolist/s/ua1tlQY8DT To keep the app mantainable my idea was basic support with no metadata matching. I think we should separate things, your pull request is incredible as it is already! |
Yeah.... I definitely don't want to touch this one 😁 |
|
If they don't add this feature, I'm going to keep the APK and just load it up when I want to download songs on my internal storage. Just remember to backup before hand. |
- Add format picker dialog when downloading songs (shows bitrate/codec) - Add custom download path support via SAF (Storage Access Framework) - Export downloads to user-selected folder with Artist/Title structure - Integrate Bento4 native library for M4A metadata embedding (cover art, title, artist, album, year) - Add "swap download" option to re-download with different quality - Add database schema migration for downloadUri tracking - Only embed metadata for M4A files >= 128kbps (low bitrate compatibility) - Show metadata badge on format options that support embedding
- Use downloadUri directly for playback instead of ExoPlayer downloadCache to prevent format mismatch errors (MatroskaExtractor parsing M4A data) - Check targetItag before cache in DownloadUtil to respect user format selection - Clear playerCache when specific format requested to ensure fresh fetch - Fix URL cache expiry check (was using wrong comparison operator) - Reorder ExtractorsFactory: FragmentedMp4Extractor first for M4A files - Add detailed logging for download and cache resolution debugging
- Move Bento4 library and JNI wrapper to metrolist-coverart-lib repository - Replace embedded code with git submodule reference - This reduces main repository size by ~77,000 lines - Library can now be independently versioned and updated Submodule: https://github.com/MetrolistGroup/metrolist-coverart-lib
- Embed album artist (aART) and track number (trkn) in M4A files - Join all song artists for the Artist field (e.g., "Lady Gaga, Bruno Mars") - Fetch missing metadata (year, album artist, track position) from YouTube - Update native JNI and Kotlin wrapper signatures
…style - Add header icon in circular container - Add quality legend indicators (High/Medium/Low) - Use card-based format items with radio buttons - Add BEST badge for highest quality option - Add + Metadata badge for M4A formats - Improve visual hierarchy and spacing
…e build - Add download format picker dialog to YouTubeSongMenu - Add ProGuard keep rules for CoverArtNative JNI bindings
- Keep CoverArtEmbedder and DownloadExportHelper classes - Add swap download option to YouTubeSongMenu
- Add download format picker dialog when downloading albums - Add swap download option to re-download with different format - Use buildList pattern for download menu items
Songs downloaded before the custom path feature was added don't have downloadUri set. Add fallback to check ExoPlayer download cache for these legacy downloads to ensure they still play after updating.
WebM audio files now export with .ogg extension for better compatibility with offline music players. No quality loss - same Opus codec data, just different container extension that's more widely recognized.
Extract full path from document URI (e.g., "Music/Metrolist" instead of just "Metrolist") for clearer path display in storage settings.
- Update YTPlayerUtils to use new PoTokenGenerator.generateContentToken API - Fix schema 34.json to include downloadUri field
3764d36 to
f400f91
Compare
- Fix race condition in metadata embedding by making format storage synchronous - Add artist relationship creation from player response for proper folder organization - Add format picker dialog for playlist downloads (local and YouTube) - Fix format fallback to prefer same codec type when exact itag unavailable - Fix state updates happening on wrong thread in AlbumMenu








Summary
New Features
Bug Fixes
Technical
Test plan
Bento4 m4a embeds: