gelli icon indicating copy to clipboard operation
gelli copied to clipboard

Add option to download music for offline playback

Open Cadair opened this issue 4 years ago • 16 comments

This is mentioned as a future feature in the readme but there wasn't an issue open for it.

This is the main thing I would need in this app to be able to completely replace my use of (sub)sonic and dsub.

Cadair avatar Jul 09 '20 11:07 Cadair

I already have a rough idea of what it would look like (ExoPlayer supports caching the files during or before stream so we could utilize that) but haven't had nearly enough time to actually implement it.

dkanada avatar Jul 09 '20 11:07 dkanada

Please add this when you can will be a game changer for jellyfin!!!

screwfaze avatar Jul 14 '20 20:07 screwfaze

Gelli has been super useful when I'm around the house, but since my Jellyfin server is only accessible on the local network or via my VPN, it's not practical to use when out and about. Adding this feature would make a huge difference to me, allowing me to use Gelli as my primary music player.

JPinSPACE avatar Aug 18 '20 14:08 JPinSPACE

Please can anyone add this feature as it is the most important when using music apps on the go and would make this a daily driver for me.

Thanks

screwfaze avatar Sep 05 '20 19:09 screwfaze

I'd like to take a crack at this. @dkanada can you give me a rough summary of what needs to be done so I know where to start?

twiclo avatar Oct 23 '20 02:10 twiclo

@twiclo the timing is great, because I'm looking into it as well. My current plan was caching all the metadata in a local database and using it throughout the app, then adding two services. One would refresh the database as efficiently as possible, and the other would handle user events like favorites, playlist updates, and watch status. At that point, all API requests would get handled by those two services, with the rest of the app querying the database. The one exception would be the audio player itself, which will stay mostly the same. The final step would be adding a third service to handle the offline cache.

I'm currently migrating the SongLoader and QueueStore to Room, which will be a guideline for the rest of the database. It should be a pretty standard implementation, but this is my first time using that library so it will be a learning experience. The one concern I have is that caching all metadata will be too inefficient, but it sounds a lot easier than trying to support both API and database requests throughout the user interface. It also adds a lot of room for cool features like queueing downloads while offline or storing user events, then pushing them to the server when back online.

I'd love to hear your thoughts on the plan as well as possible ways to split up the work. I believe the services can be added independently, and the database could probably be filled out over time. The interface is the least of our concerns, since it will basically just be another entry in the context menu to queue downloads on the third service.

dkanada avatar Oct 23 '20 02:10 dkanada

I haven't had a chance to look over the code base nor do I have much experience with android development (mostly rust backend work) so I'll refer to your judgement. I would like some more explanation on what a "service" actually is though. Are these just flows that you'll call when a specific thing needs to be done? What's your rational behind putting favorites and watch status into one of these services?

Please let me know where I should start in the code base to familiarize myself with the plan and if there's maybe any resources on android development you'd recommend.

twiclo avatar Oct 23 '20 03:10 twiclo

You can find documentation on services here; https://developer.android.com/guide/components/services

oddstr13 avatar Oct 23 '20 03:10 oddstr13

Okay makes sense. @dkanada are there any services deployed already in gelli or were you just about to start migrating over to them?

twiclo avatar Oct 23 '20 05:10 twiclo

@twiclo if you're not familiar with Android development I would start with something a bit smaller to get familiar with the codebase at least. As an example, the splash screen pull request has some really good interface design and only needs a few issues resolved before it's ready. You could also pick out a small bug (there are a ton of them) and work your way through the code while fixing it.

dkanada avatar Oct 23 '20 12:10 dkanada

I came here to make a feature request for this, but it looks like everyone has this under control!

Side note, I did want to say to @JPinSPACE that Jellyfin is not exclusively accessible from within your home network! It may take just a bit of tinkering, but by setting up port forwarding on your router, you can access Jellyfin (which means Gelli too) from anywhere. It obviously still doesn't allow you to download music offline, but it does let you take your collection with you.

phillipprado avatar Nov 25 '20 08:11 phillipprado

Any movement on this? I know it's a lot to implement... maybe a PR with a checklist to track the progress? :)

tnyeanderson avatar Mar 02 '21 23:03 tnyeanderson

This is something I'd really like to see, I just wanted to add the suggestion of adding a new tab or filter option to show only stuff that is downloaded. (Albums, Playlists, songs, etc)

seniorm0ment avatar May 03 '21 20:05 seniorm0ment

Hey! Small question about housekeeping: As far as I understood from #28, @dkanada you did not close this issue yet because you will consider the download feature done with the release of 1.4.0.

For the download mechanism, you were talking about utilitizing ExoPlayer's caching mechanism. Is this still up to date? I'm asking because as far as I understand, this would mean the transcoding settings would affect the download quality (tracks would be downloaded in the transcoded quality if transcoding is enabled).

Though this behaviour could be considered a side effect, I believe it might actually be quite useful for the time being, since it would mean that there is a way to control the download quality, until there is a dedicated option for that eventually in a future version.

leso-kn avatar Sep 22 '21 21:09 leso-kn

Songs I've downloaded so far using Gelli were always downloaded in their original file format and quality. I could imagine that might be related to #189.

> Unless of cause ExoPlayer's caching mechanism is not utilitized after all. If that's the case, I understand that transcoding won't affect the download quality and I would maybe want to track the idea of a download quality setting by opening a new issue.

leso-kn avatar Sep 22 '21 21:09 leso-kn

According to https://github.com/dkanada/gelli/issues/28#issuecomment-843974778 downloads are supposed to work? I can't seem to get it to work properly. I can click the download button to download a song or album or artist, but after the notification finishes, it still doesen't actually show the song when I am offline.

NoSadBeHappy avatar Aug 23 '23 20:08 NoSadBeHappy