Open sujansujan opened 2 weeks ago
Thank you for reporting this issue!
It sounds like you've set a custom download directory on an SD card. This may be causing either a parsing error when writing data to disk or a permissions issue. The actual error likely occurs during the media download process. Could you please provide the logs from when you download the item?
2024-11-06T07:36:50.790814 AppLifecycleState Detached 2024-11-06T07:36:50.614354 AppLifecycleState Detached 2024-11-06T07:35:49.437737 item_view PathNotFoundException: Cannot open file, path = '/storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/meta.json' (OS Error: No such file or directory, errno = 2)
2024-11-06T07:35:49.436270 item_view Building item view for 3bf79808-ad8f-4242-910f-def1e17fd1c1 2024-11-06T07:35:47.198412 item_view PathNotFoundException: Cannot open file, path = '/storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/meta.json' (OS Error: No such file or directory, errno = 2)
2024-11-06T07:35:47.196790 item_view Building item view for 3bf79808-ad8f-4242-910f-def1e17fd1c1 2024-11-06T07:35:46.480382 CacheInterceptor Caching: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:35:46.440512 CacheInterceptor Caching: http://100.76.8.54:13378/api/me 2024-11-06T07:35:46.303224 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/me 2024-11-06T07:35:46.294643 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:35:46.279858 progress_provider getProgress 2024-11-06T07:34:53.264237 Unnamed Request: http://100.76.8.54:13378/api/me/progress/3bf79808-ad8f-4242-910f-def1e17fd1c1 2024-11-06T07:34:53.256620 item_view PathNotFoundException: Cannot open file, path = '/storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/meta.json' (OS Error: No such file or directory, errno = 2)
2024-11-06T07:34:53.253296 item_view Building item view for 3bf79808-ad8f-4242-910f-def1e17fd1c1 2024-11-06T07:34:53.241460 item_view Building item view for 3bf79808-ad8f-4242-910f-def1e17fd1c1 2024-11-06T07:34:53.239996 Unnamed Reading file: /storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/meta.json 2024-11-06T07:34:53.239960 Unnamed DownloadInfo(index: 29886432, type: MediaTypeDownload.book, userId: e4f9cc1d-7d48-4e86-92b7-7b596349b801, displayName: Master of Puppets (Unabridged), filename: Master of Puppets_128_44100_Stereo.m4b, format: .m4b, libraryId: aae65e1f-ec22-46a5-86e9-9392a69ca5b6, libraryName: audiobooks, itemId: 3bf79808-ad8f-4242-910f-def1e17fd1c1, status: TaskStatus.complete, size: 694925372, episodeId: null, filePath: /storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/Master of Puppets_128_44100_Stereo.m4b, duration: null, bitrate: null, codec: null, mimeType: null, embeddedCoverArt: null) 2024-11-06T07:34:52.678220 CacheInterceptor Caching: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:34:52.637887 CacheInterceptor Caching: http://100.76.8.54:13378/api/me 2024-11-06T07:34:52.473984 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/me 2024-11-06T07:34:52.468008 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:34:52.452051 progress_provider getProgress 2024-11-06T07:34:51.456052 CacheInterceptor Caching: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:34:51.398504 CacheInterceptor Caching: http://100.76.8.54:13378/api/me 2024-11-06T07:34:51.222862 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/me 2024-11-06T07:34:51.217275 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:34:51.203858 progress_provider getProgress 2024-11-06T07:34:50.339463 CacheInterceptor Caching: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:34:50.260701 CacheInterceptor Caching: http://100.76.8.54:13378/api/libraries 2024-11-06T07:34:50.260160 CacheInterceptor Caching: http://100.76.8.54:13378/api/me 2024-11-06T07:34:50.092912 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/libraries/aae65e1f-ec22-46a5-86e9-9392a69ca5b6/personalized?limit=15 2024-11-06T07:34:50.069224 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/libraries 2024-11-06T07:34:50.066354 CacheInterceptor Cache hit: http://100.76.8.54:13378/api/me 2024-11-06T07:34:50.062673 Unnamed Request: http://100.76.8.54:13378/api/items/7bcf5a2c-e6b3-400d-8db4-5a689d5a2720? 2024-11-06T07:34:50.062574 Unnamed Request: http://100.76.8.54:13378/api/me? 2024-11-06T07:34:50.049997 Unnamed Connectivity changed: [ConnectivityResult.wifi, ConnectivityResult.vpn] 2024-11-06T07:34:50.029004 Unnamed DownloadInfo(index: 29886444, type: MediaTypeDownload.book, userId: e4f9cc1d-7d48-4e86-92b7-7b596349b801, displayName: The Silence of Unworthy Gods, filename: The Silence of Unworthy Gods.m4b, format: .m4b, libraryId: aae65e1f-ec22-46a5-86e9-9392a69ca5b6, libraryName: audiobooks, itemId: 7bcf5a2c-e6b3-400d-8db4-5a689d5a2720, status: TaskStatus.canceled, size: 1184657174, episodeId: null, filePath: null, duration: null, bitrate: null, codec: null, mimeType: null, embeddedCoverArt: null) 2024-11-06T07:34:50.028110 Unnamed ConnectionNotifier initialized 2024-11-06T07:34:50.023517 progress_provider getBookmarks 2024-11-06T07:34:50.023082 OfflineProgress Number of offline progress items: 1 2024-11-06T07:34:50.020120 progress_provider getProgress 2024-11-06T07:34:50.018220 init @ number of users 1 2024-11-06T07:34:50.008898 Unnamed Stop sending
I did not see anything suspicious. I will try to reproduce the bug on an emulated device with an emulated SD card tomorrow.
I’m currently unable to reproduce the bug. I’ve just realized that /storage/emulated doesn’t necessarily indicate an SD card. Could you clarify if you’ve set a custom save location and/or installing the app on an SD card, to help me understand the issue better?
Ideally, the app shouldn’t populate this path if it lacks the required permissions (What it does in my case). This situation suggests it might have write access but not read access. But I am very unsure
Save location is within Internal storage, not SD card. /storage/emulated/0/ is how path is shown in android. i am also thinking the same about not havinng read permission. i even tried manually creating metadata.json file to check if it works, but it didnot.
So no meta.json is created at all? is the actual media file downloaded?
Meta.json is not created but the media file is downloaded.
Are you sure the above log includes the item download event? It seems unlikely that the media item could download without the meta.json file, and without any error message.
Additionally, the log statement log('Downloading to: $savePath ($baseDirectory)');
doesn’t appear in the logs, though it should if a download has actually started.
i redownloaded again after deleting previous download. there is this line though. yes, I do get fully downloaded file in the path mentioned below and I can play it with external players like smart audiobook player
2024-11-09T07:20:59.010780 Unnamed DownloadInfo(index: 29886432, type: MediaTypeDownload.book, userId: e4f9cc1d-7d48-4e86-92b7-7b596349b801, displayName: Master of Puppets (Unabridged), filename: Master of Puppets_128_44100_Stereo.m4b, format: .m4b, libraryId: aae65e1f-ec22-46a5-86e9-9392a69ca5b6, libraryName: audiobooks, itemId: 3bf79808-ad8f-4242-910f-def1e17fd1c1, status: TaskStatus.complete, size: 694925372, episodeId: null, filePath: /storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/Master of Puppets_128_44100_Stereo.m4b, duration: null, bitrate: null, codec: null, mimeType: null, embeddedCoverArt: null)
I noticed that the statement log('Downloading to: $savePath ($baseDirectory)'); wasn’t functioning correctly in the released application. This will be fixed in the next release, which will also delete the download if it fails.
As for the other file not being created, I’m unable to diagnose the cause, as there’s no error handling in place to prevent a crash. It should crash if not createable. If the file isn’t being created, it may be related to your device’s file system. Could you try setting a custom folder in the settings of this app to see if that resolves the issue?
same issue with custom folder. App streams well, i will just use that. downloading is a "good to have" but not a necessity.
Could you please share the new logs with the updated logging?
You can paste the logs like this for better formatting: ``` Your log here ```
2024-11-11T21:06:58.820163 Unnamed Downloading to: /storage/emulated/0/Buchable/3bf79808-ad8f-4242-910f-def1e17fd1c1 (BaseDirectory.root)
2024-11-11T21:06:57.891945 item_view Building item view for 3bf79808-ad8f-4242-910f-def1e17fd1c1
Why does it not log the error xD. I will have to take a look if more people expierience the error. Thanks for now
I have the same error. Strangely it works right after the download. When I closed the app it wasn't working anymore.
It caches the response, so it doesn't need to reload all the data, allowing it to display content immediately. This approach conserves data usage :)). That's why it does work right after. I'll run some additional tests on my device. But I just tested it with the newest version on my device - downloaded via Play Store and have no issue at all. I don't even know where to search, because it seem to have write and read permission (As the file is downloaded). Idk if you can do this, but it would be a help if you could build it from source in debug and check the real logs (I can only log so much via the logs provided to the users)
@LarryBetz and all,
The upcoming version, which should be available on the Play Store in about an hour, will address the crash issue but may not fully resolve the underlying error. I’m still uncertain if the media is available for playback then.
This update includes significantly more logging around the creation of meta.json. If you install the update, could you please share the updated logs? Thanks!
The new version seems to be working, it's even playing my previously downloaded files.
It just does not crash anymore and streams the file now, if there is no meta.json.
Could you please look into the logs if there is an error. I made a really small change to file creation. Maybe this fixed it, but I don't think so.
Thank you very much!
It just does not crash anymore and streams the file now, if there is no meta.json.
Could you please look into the logs if there is an error. I made a really small change to file creation. Maybe this fixed it, but I don't think so.
Thank you very much!
I'm not at home right now but I just disabled mobile data and was able to play the file. Although I have created an empty file called meta.json in the folder previously to test it. After deleting it the audiobook isn't working anymore, even with a new empty meta.json
2024-11-15T13:22:13.788462 DownloadProvider Writing meta.json to: /storage/emulated/0/Audiobooks/f47db04f-6fe2-4d4c-8e3f-7285d035c3a7/meta.json 2024-11-15T13:22:13.788450 DownloadProvider Creating directory: /storage/emulated/0/Audiobooks/f47db04f-6fe2-4d4c-8e3f-7285d035c3a7 2024-11-15T13:22:13.747315 DownloadProvider Saving meta.json to: /storage/emulated/0/Audiobooks/f47db04f-6fe2-4d4c-8e3f-7285d035c3a7/meta.json 2024-11-15T13:22:13.747270 DownloadProvider Does safe json?: /storage/emulated/0/Audiobooks/f47db04f-6fe2-4d4c-8e3f-7285d035c3a7/meta.json 2024-11-15T13:22:13.705369 Unnamed Downloading to: /storage/emulated/0/Audiobooks/f47db04f-6fe2-4d4c-8e3f-7285d035c3a7 (BaseDirectory.root) 2024-11-15T13:22:12.286640 removeDownload Deleting folder: /storage/emulated/0/Audiobooks/f47db04f-6fe2-4d4c-8e3f-7285d035c3a7 2024-11-15T13:22:09.837092 item_view Building item view for f47db04f-6fe2-4d4c-8e3f-7285d035c3a7
Here is the log from a new download. Playing the book offline is not working.
Bug Report
Description of the Issue The application is encountering a critical error when attempting to access an audiobook's metadata file. The error occurs when trying to open a meta.json file for an audiobook in the emulated storage directory. I am on android.
Steps to Reproduce Outline the steps needed to reproduce this issue:
Expected Behavior Open audiobook page.
Observed Behavior Error Type: PathNotFoundException File Path: /storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/meta.json System Error: No such file or directory (errno = 2) Device Status: Android device
Device and Platform Details
Additional Context or Screenshots
Additional Logs 2024-11-06T07:36:50.790814 AppLifecycleState Detached 2024-11-06T07:36:50.614354 AppLifecycleState Detached 2024-11-06T07:35:49.437737 item_view PathNotFoundException: Cannot open file, path = '/storage/emulated/0/Audiobooks/3bf79808-ad8f-4242-910f-def1e17fd1c1/meta.json' (OS Error: No such file or directory, errno = 2)
0 _File.throwIfError (dart:io/file_impl.dart:675)
1 _File.openSync (dart:io/file_impl.dart:490)
2 _File.readAsBytesSync (dart:io/file_impl.dart:574)
3 _File.readAsStringSync (dart:io/file_impl.dart:624)
4 itemProvider. (package:abs_flutter/provider/library_item_provider.dart:63)
5 FamilyBase.call. (package:riverpod/src/framework/family.dart:150)
6 FutureProvider._create (package:riverpod/src/future_provider/base.dart:65)
7 FutureProviderElement.create. (package:riverpod/src/future_provider/base.dart:107)
8 FutureHandlerProviderElementMixin.handleFuture. (package:riverpod/src/async_notifier/base.dart:334)
9 FutureHandlerProviderElementMixin._handleAsync (package:riverpod/src/async_notifier/base.dart:381)
10 FutureHandlerProviderElementMixin.handleFuture (package:riverpod/src/async_notifier/base.dart:328)
11 FutureProviderElement.create (package:riverpod/src/future_provider/base.dart:106)
12 ProviderElementBase.buildState (package:riverpod/src/framework/element.dart:409)
13 ProviderElementBase.mount (package:riverpod/src/framework/element.dart:226)
14 _StateReader._create (package:riverpod/src/framework/container.dart:47)
15 _StateReader.getElement (package:riverpod/src/framework/container.dart:35)
16 ProviderContainer.readProviderElement (package:riverpod/src/framework/container.dart:479)
17 ProviderBase.addListener (package:riverpod/src/framework/provider_base.dart:79)
18 ProviderContainer.listen (package:riverpod/src/framework/container.dart:280)
19 ConsumerStatefulElement.watch. (package:flutter_riverpod/src/consumer.dart:564)
20 _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:543)
21 ConsumerStatefulElement.watch (package:flutter_riverpod/src/consumer.dart:557)
22 BookView.build (package:abs_flutter/features/library/item/book_view.dart:29)