jmshrv / finamp

A Jellyfin music client for mobile
Mozilla Public License 2.0
1.67k stars 117 forks source link

Beta 0.9.7 - Favorites won't download / sync #746

Open Nerokor opened 1 month ago

Nerokor commented 1 month ago

I am on Android 11. After updating to 9.7, I encountered an issue when trying to Download all favorites: the error message "Null check operator used on a null value" kept popping up.

I've tried several troubleshooting steps to resolve this issue:

I've also cleared the app cache, but that didn't make a difference either.

I tired to download a single track and that seems to work but the favorites "Null check operator used on a null value" keeps poping up despite having deleted favorites and having removed it from syncing. if I go into Download Settings instead of a Arrow or Trash icon next to Download all favorites I'll see a lockpad.

[SyncBuffer/INFO] 2024-05-23 23:11:44.524858: Error downloading children for finampCollection Favorites: Null check operator used on a null value
[SyncBuffer/FINEST] 2024-05-23 23:11:44.526659: Sync of Favorites failed with error Null check operator used on a null value, retrying
[SyncBuffer/FINER] 2024-05-23 23:11:44.542378: Syncing unknown Favorites with required:false viewId:null
[SyncBuffer/INFO] 2024-05-23 23:11:44.543397: Error downloading children for finampCollection Favorites: Null check operator used on a null value
[SyncBuffer/FINEST] 2024-05-23 23:11:44.544552: Sync of Favorites failed with error Null check operator used on a null value, retrying
[SyncBuffer/FINER] 2024-05-23 23:11:44.547398: Syncing unknown Favorites with required:true viewId:null
[JellyfinApiHelper/FINE] 2024-05-23 23:11:44.548226: Getting items.
[JellyfinApiHelper/FINE] 2024-05-23 23:11:48.500587: Getting items.
[SyncBuffer/INFO] 2024-05-23 23:11:49.675287: Error downloading children for finampCollection Favorites: Null check operator used on a null value
[SyncBuffer/SEVERE] 2024-05-23 23:11:49.677077: Sync of Favorites repeatedly failed, skipping.
[SyncBuffer/SEVERE] 2024-05-23 23:11:49.792227: Null check operator used on a null value
        #0      DownloadsSyncService._syncDownload (package:finamp/services/downloads_service_backend.dart:1029)
        <asynchronous suspension>
        #1      DownloadsSyncService._advanceQueue (package:finamp/services/downloads_service_backend.dart:810)
        <asynchronous suspension>

[GlobalSnackbar/WARNING] 2024-05-23 23:11:49.818573: Displaying error: Null check operator used on a null value
[GlobalSnackbar/WARNING] 2024-05-23 23:11:49.819533: #0      DownloadsSyncService._syncDownload (package:finamp/services/downloads_service_backend.dart:1029)
        <asynchronous suspension>
        #1      DownloadsSyncService._advanceQueue (package:finamp/services/downloads_service_backend.dart:810)
        <asynchronous suspension>

[SyncBuffer/INFO] 2024-05-23 23:11:49.835108: All syncs complete.
Komodo5197 commented 1 month ago

Looks like I forgot about the old version of the 'favorites' collection in some of the sync code. If you turn off the 'sync all favorite statuses' setting, then run a download repair, that might get everything working normally again?

Nerokor commented 1 month ago

I cleared the app cache and data this time around but finamp wasn't opening anymore so I continued to uninstalled finamp and removed any files leftover through the google play store, then reinstalled finamp. Everything looks good now and favorties are currently downloading. Thanks for replying!

I'm fairly certain when I was messing around with it I had done what you asked but the error still persisted. It's like it was stuck and kept trying to download favorites even if I turned off sync all favorite it would clear then come back after a while with that error in the download queue. Thanks again!

Chaphasilor commented 1 month ago

That might have been the sync not properly terminating, causing the repair to be queued but never starting...
Sorry for the inconvenience!

RantoPhantom commented 1 month ago

I had the same problems so I deleted Finamp and reinstalled it, at first Favorites seemed to have been downloaded correctly image

But none of the songs can be played, and the metadata bar does not display the file type (M4A@128kbps) image

Even weirder is if I favorited an album all of the songs that are Not favorited in that album is fine image

Edit: When I start a mix with those corrupted songs, any subsequent songs, even if they are normal, won't play

Confirmed, all songs are normal when downloaded with any other method, just the "download all favorites" option is corrupted

Chaphasilor commented 1 month ago

@RantoPhantom can you try using a transcoded download instead? That might be a temporary solution...

RantoPhantom commented 1 month ago

@RantoPhantom can you try using a transcoded download instead? That might be a temporary solution...

The transcoded files worked fine! Though this takes quite a toll on my server and I don't have many files so I'll just stick to downloading all files for now. Thanks for the reply, hope this gets fixed soon!

Komodo5197 commented 1 month ago

I've discovered that _getFinampCollectionChildren caches children with no mediaSources/mediaStream info, so the downloads persistently don't have codec info. Then the feature_chips uses the offline codec with the downloaded song, but overwrites the offline bitrate with the one from the mediastream, which metadata merges with the online one for some reason. So that explains the missing codec name. I haven't seen a song not play though - maybe some file types don't work without extensions like on iOS?

Chaphasilor commented 1 month ago

About the online/offline hybrid with modified mediaStreams: essentially, the top-level bitrate of MediaSourceInfo seems to represent the bitrate for the whole file, including images and lyrics (and probably the video stream for music videos, etc.). So to show the actual music bitrate (e.g. 192 kbps) instead of a weird value like 204 kbps, the mediaStream bitrate is always used.
And since Finamp uses downloaded files even in offline mode, we need to monkey-patch the bitrate to stay consistent...