jarnedemeulemeester / findroid

Third-party native Jellyfin Android app
GNU General Public License v3.0
2.41k stars 148 forks source link

Can't download a file large file #799

Open rodude123 opened 1 month ago

rodude123 commented 1 month ago

Describe the bug Download fails for large file. I'm not too sure if it's time or size.

To Reproduce Steps to reproduce the behavior:

  1. Open an episode of a show (How I met your mother Season 1 Episode 1 - Pilot)
  2. Click on download

Expected behavior The file should be downloaded.

Screenshots Screenshot_20240730-173211536 (1).jpg Screenshot_20240730-173340838.jpg

Device info (please complete the following information):

Additional context I'm not too sure what I'm doing wrong. I'm just downloading a 393MB file I can provide more info if required and asked for.

NineBallo commented 1 month ago

I'm having the same issue. Weirder is multiple files cause it to fail faster, and usually around 4-5 will kill the entire queue.

In my case I'm running android 14 but am also able to download short/smaller videos.

Jcuhfehl commented 1 month ago

As far as I know, this is because the android download manager (which is used by findroid) doesn't attempt to resume a download if fails for a bit. So if you lose your wifi connection for a couple of seconds while downloading, the download could very well fail completely. This problem is made worse by slower wifi, larger files, and downloading multiple files at once, all because the total time to download increases, so there is a larger chance of a temporary disconnect.

NineBallo commented 1 month ago

As far as I know, this is because the android download manager (which is used by findroid) doesn't attempt to resume a download if fails for a bit. So if you lose your wifi connection for a couple of seconds while downloading, the download could very well fail completely. This problem is made worse by slower wifi, larger files, and downloading multiple files at once, all because the total time to download increases, so there is a larger chance of a temporary disconnect.

So this does seem to be part of it as viewing the logs (logcat) points in this direction. However, when connected with ethernet, the same issue exists... which doesn't make sense for this kind of issue.

Viewing the logs of download manager, I'm getting a lot of warnings for:

...JobScheduler: Job didn't exist in JobStore: faab869 #u0a85/509 DownloadManager:com.android.providers.downloads ...JobService: onNetworkChanged() not implemented in com.android.providers.downloads.DownloadJobService. Must override in a subclass.

And one error: ..NotificationService: Package enqueue rate is **X**. Shedding 0|com.android.providers.downloads|0|3:510|10085. package=com.android.providers.downloads

EDIT: My logs here are from @Jcuhfehl's build but the issue exists on both the mainline and theirs.

The notification error seems to be a rate limiting issue, where the status can only be updated so often... But whats weird is would that not be an internal download manager bug? I am getting that one on both download manager and the findroid APK.

As for just the APK itself I'm getting a lot of Method exceeds compiler instruction limit: 49562 in org.jellyfin.sdk.model.api.BaseItemDto org.jellyfin.sdk.model.api.BaseItemDto$$serializer.deserialize(z5.c) Info lines.

However the interesting line to me is this one: StorageManagerService: Asked to fixup an app dir without a userId: /storage/77FC-550A/Android/data/io.github.jcuhfehl.findroid/files/downloads As it is a proper error line.

I'm mainly a C/C++ embedded/linux guy so I don't quite know how to read these Java logs. But am competent enough to make changes and test as needed. Just need a starting place to know what needs to be implemented and what the error even is.

NineBallo commented 1 month ago

Alright, I'm not sure why but I factory reset my device and it works now :/. Just gonna run with it but I guess its not an issue with this program. I am however very confused by what could've caused it...