It appears that sometimes ffprobe can return a NULL value for the format.tags field when scanning files. This causes the Android app to crash when scanning local media folders.
2022-04-26 09:48:26.094 9558-9631/com.audiobookshelf.app E/Capacitor: Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:121)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0$com-getcapacitor-Bridge(Bridge.java:592)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda5.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class com.audiobookshelf.app.data.AudioProbeFormat] value failed for JSON property tags due to missing (therefore NULL) value for creator parameter tags which is a non-nullable type
at [Source: (String)"{
"streams": [
{
"index": 0,
"codec_name": "mp3",
"codec_long_name": "unknown",
"codec_type": "audio",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "fltp",
"sample_rate": "22050",
"channels": 1,
"channel_layout": "mono",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
There's already logic in place to handle missing title and artist tags, so this PR just makes that code also handle the tags field being null.
Running this change in an Android emulator, I no longer see the crash when scanning the local media folder.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/148
**Author:** [@selfhost-alt](https://github.com/selfhost-alt)
**Created:** 4/26/2022
**Status:** ✅ Merged
**Merged:** 4/26/2022
**Merged by:** [@advplyr](https://github.com/advplyr)
**Base:** `master` ← **Head:** `fix-local-scanning-android`
---
### 📝 Commits (1)
- [`511386e`](https://github.com/advplyr/audiobookshelf-app/commit/511386e80a854a00d6ffd75c7041066af675819a) Handle audio probes that don't return any tags
### 📊 Changes
**1 file changed** (+3 additions, -3 deletions)
<details>
<summary>View changed files</summary>
📝 `android/app/src/main/java/com/audiobookshelf/app/data/AudioProbeResult.kt` (+3 -3)
</details>
### 📄 Description
It appears that sometimes `ffprobe` can return a NULL value for the `format.tags` field when scanning files. This causes the Android app to crash when scanning local media folders.
Example FFProbe response:
```
{
"streams": [
{
"index": 0,
"codec_name": "mp3",
"codec_long_name": "unknown",
"codec_type": "audio",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "fltp",
"sample_rate": "22050",
"channels": 1,
"channel_layout": "mono",
"bits_per_sample": 0,
"r_frame_rate": "0\/0",
"avg_frame_rate": "0\/0",
"time_base": "1\/14112000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 445606502544,
"duration": "31576.424500",
"bit_rate": "32000",
"disposition": {
"default": 0,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0,
"captions": 0,
"descriptions": 0,
"metadata": 0,
"dependent": 0,
"still_image": 0
}
}
],
"chapters": [],
"format": {
"filename": "\/storage\/emulated\/0\/Audiobookshelf\/Test\/Test.mp3",
"nb_streams": 1,
"nb_programs": 0,
"format_name": "mp3",
"start_time": "0.000000",
"duration": "31576.424500",
"size": "126305698",
"bit_rate": "32000",
"probe_score": 51
}
}
```
The subsequent crash looks like this:
```
2022-04-26 09:48:26.094 9558-9631/com.audiobookshelf.app E/Capacitor: Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:121)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0$com-getcapacitor-Bridge(Bridge.java:592)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda5.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class com.audiobookshelf.app.data.AudioProbeFormat] value failed for JSON property tags due to missing (therefore NULL) value for creator parameter tags which is a non-nullable type
at [Source: (String)"{
"streams": [
{
"index": 0,
"codec_name": "mp3",
"codec_long_name": "unknown",
"codec_type": "audio",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "fltp",
"sample_rate": "22050",
"channels": 1,
"channel_layout": "mono",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
```
There's already logic in place to handle missing `title` and `artist` tags, so this PR just makes that code also handle the `tags` field being null.
Running this change in an Android emulator, I no longer see the crash when scanning the local media folder.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/advplyr/audiobookshelf-app/pull/148
Author: @selfhost-alt
Created: 4/26/2022
Status: ✅ Merged
Merged: 4/26/2022
Merged by: @advplyr
Base:
master← Head:fix-local-scanning-android📝 Commits (1)
511386eHandle audio probes that don't return any tags📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
android/app/src/main/java/com/audiobookshelf/app/data/AudioProbeResult.kt(+3 -3)📄 Description
It appears that sometimes
ffprobecan return a NULL value for theformat.tagsfield when scanning files. This causes the Android app to crash when scanning local media folders.Example FFProbe response:
The subsequent crash looks like this:
There's already logic in place to handle missing
titleandartisttags, so this PR just makes that code also handle thetagsfield being null.Running this change in an Android emulator, I no longer see the crash when scanning the local media folder.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.