-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Redesign] Downloads Storage Rewrite #568
[Redesign] Downloads Storage Rewrite #568
Conversation
…bum/Playlist ordering now works.
…-downloads-rework # Conflicts: # lib/components/AlbumScreen/item_info.dart # lib/components/AlbumScreen/song_list_tile.dart # lib/l10n/app_en.arb # lib/main.dart # lib/models/finamp_models.dart # lib/models/finamp_models.g.dart # lib/services/jellyfin_api.chopper.dart
Oh man, this is amazing. I'm sure @jmshrv will love this too! Is this ready to take a look at already? Do you need any help or designs for this? Regarding your TODOs, here are some thoughts:
Lastly, I'm wondering if the |
This is absolutely amazing, thanks for making what I couldn't in 3 years :) I'll install this on my phone now and see how well it works - by the sounds of it, it should be way more reliable than Flutter downloader lol |
The actual download/delete/playback functionality seems mostly stable on my end, if you want to try it out. In regards to design help, there's a couple UI questions I haven't made a decision on if you want to weigh in, and of course I'm always open to ideas.
I didn't really put much thought into what branch to target. If you want this targeting the redesign, I can do that. I noticed you just merged main into the redesign, so it shouldn't be to bad to merge the redesign into this. I believe requiring Wifi is just a flag with background_downloder, so I'll throw that in. Regarding partial collection filtering, if there was an option where should I put it? Regarding showing greyed out album tracks - currently, that info is not downloaded. I could add a songInfo type and pretty easily grab everything for albums. Playlists will never have parent metadata unless they have been downloaded, so all the songs must be there although some may have failed. Persumebly they should still show, but greyed out, if this functionality is added? The metadata size probably doesn't matter, it's tiny compared to the songs even if we double it with a bunch of songInfo nodes, and it seems unlikely for the songs to have many unique images. Grabbing children for artists is messier because it introduces information for empty albums that would need to be filtered out. Also, a note - I'm adding separate copies of metadata in info types because some sort of required flag seems annoying to track and adding some sort of 'info' link types would lead to loops, which I'd rather avoid. |
Okay. I did merge Regarding your questions:
Also:
|
…rework # Conflicts: # android/app/build.gradle # lib/components/AlbumScreen/album_screen_content.dart # lib/components/AlbumScreen/downloaded_indicator.dart # lib/components/AlbumScreen/item_info.dart # lib/components/AlbumScreen/song_list_tile.dart # lib/components/DownloadsScreen/download_error_screen_button.dart # lib/components/DownloadsScreen/download_missing_images_button.dart # lib/components/DownloadsScreen/sync_downloaded_playlists.dart # lib/components/MusicScreen/album_item.dart # lib/components/MusicScreen/music_screen_tab_view.dart # lib/l10n/app_en.arb # lib/main.dart # lib/models/finamp_models.dart # lib/models/finamp_models.g.dart # lib/screens/artist_screen.dart # lib/screens/downloads_screen.dart # lib/services/album_image_provider.dart # lib/services/audio_service_helper.dart # lib/services/download_update_stream.dart # lib/services/downloads_helper.dart # lib/services/jellyfin_api_helper.dart # lib/services/music_player_background_task.dart # pubspec.lock
…artial albums, currently broken.
…in albums working properly. Added require wifi switch.
So I got about 75% of the review done now. I'll finish it tomorrow :) |
…-downloads-rework # Conflicts: # lib/components/AlbumScreen/song_list_tile.dart # lib/main.dart # lib/models/finamp_models.dart # lib/models/finamp_models.g.dart # lib/models/jellyfin_models.g.dart # lib/screens/settings_screen.dart
Didn't have as much time today as I had hoped, but I made some progress. I still haven't reviewed the localizations, I'll post the review of the other files now so you can take a look at it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor changes, and a few things that I don't fully understand yet and would like to know the reasoning behind!
lib/components/AddDownloadLocationScreen/custom_download_location_form.dart
Outdated
Show resolved
Hide resolved
Just downloaded an album and the songs were in the wrong order in offline mode, will investigate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing major here. Just a few suggestions and discussion topics :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that should be the rest of it. This PR definitely is too large 👀
I looked at the album ordering code, and it seems to work fine for me. It looks like the fallback if there aren't any track numbers might be slightly different, is it possible the album relied on that somehow? I put something that might fix this into the latest commit, it basically uses the playlist code to save off the order from the server instead of trying to sort albums ourselves. It needs a downloads repair to work properly. |
@Komodo5197 I'm guessing we could get this merged tomorrow. @jmshrv told me they'd take a look at the backup stuff, and there are only a few minor unresolved discussions left. |
Looking at the other PR, it doesn't seem to be doing anything too unique with the downloads. You should be able to look at the existing code in music_screen_tab_view, album_screen, queue_service, and maybe some other places where we do pretty much the same things already. I feel like it makes a bit more sense to get this merged first, but you can do the merges in whatever order seems best to you. |
@Komodo5197 let me know when I can click the button 🥳 |
The ios backup fix was the last review change on the list, so I think it's good. Click away. |
Awesome, merged! Many thanks for all the word you put into this, we're very grateful for it! I'm sure there are many users who will be more than happy with these new additions 😁 I'm really happy with how this turned out <3 |
Happy to help. Indeed, I don't anticipate doing anything else notable anytime soon, especially as this, the queue restore, and all the now playing queue improvements combine to fix pretty much every issue Finamp had that I personally cared about. I'm really looking forward to the beta. |
@Komodo5197 while you're still familiar with these changes, would you consider adding a section about how to work with the download system to the contribution guidelines? If you decided to write something up, please target the I'll work on a similar section for the queue service. |
Interesting migration error from @erictbar on the Discord
The specific line is: String id = (type == DownloadItemType.image)
? item.blurHash ?? item.imageId!
: item.id; Migrating an image without an ID??? |
@Komodo5197 and @jmshrv I've added the concept of a holding queue to the background downloader. It's similar in concept as the TaskQueue (it limits maximum concurrent tasks etc) but it lives on the native side and is transparent (does not change how you use the FileDownloader). Because it is native, tasks from this queue will continue to be processed even when the app is suspended by the OS. I know you've already implemented your own version of a TaskQueue but this may be worth taking a look at. Just one warming: this is a complex addition and while it passes all tests it would not surprise me if there are some bugs. If you do choose to use this, please let me know how it's working for you. |
@781flyingdutchman Even with our TaskQueue, this seems like it would be beneficial on Android to allow for more downloading when the app is suspended. I'm wondering if it would be a good or bad idea to configure this on iOS. I think just submitting everything to the native queue has been working, so it's probably not needed. |
Quite possibly! It is very difficult to predict how long an app remains unsuspended when moving to the background, as it depends on memory pressure, CPU load and - in the case of Android - the OEM strategy. Both queueing mechanisms (TaskQueue and the HoldingQueue) can be active at the same time, so one idea to test might be:
The If you do experiment, I'd love to know what you learn, as it may help others using the background_downloader. |
An attempt to implement as much of the planned download rewrite as I can. It's not done yet, but I wanted to get this out there.
Highlights:
The Design:
All download metadata is stored in a single collection of DownloadItems. Each item has a type, an optional BaseItemDto, a download state, and can require other items of arbitrary type. The primary download action is a sync, which takes a node and recalculates required children according to the node's type, fetching information from the server if needed. Then recently unconnected nodes are considered for deletion if no other nodes require them, and currently connected nodes are recursively synced. Downloads can be tracked via a DownloadStub, a simplified DownloadItem with no state used to key into it's matching DownloadItem.
The DownloadItem types:
TODO: