vanilla-music / vanilla-music-tag-editor

Vanilla Music player Tag Editor plugin
GNU General Public License v3.0
13 stars 6 forks source link

[Exception] Failed to write tag to file #3

Closed motatuc closed 7 years ago

motatuc commented 7 years ago

Hello

I am using vanilla-music 1.0.47, lyrics-plugin 1.0.1 and music-tag-editor built yesterday from source. Playing a song and loading the according lyrics works fine. However, pressing the write button throws an exception. Running this on Android N (Lineage 14.1)

01-18 10:38:03.589 15619 15619 E generic : Cannot make changes to file /storage/8024-42B8/Beatles/Submarine.mp3 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: Error while working with audio file /storage/8024-42B8/Beatles/Submarine.mp3 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: org.jaudiotagger.audio.exceptions.CannotWriteException: Cannot make changes to file /storage/8024-42B8/Beatles/Submarine.mp3 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at org.jaudiotagger.audio.generic.AudioFileWriter.precheckWrite(AudioFileWriter.java:286) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at org.jaudiotagger.audio.generic.AudioFileWriter.write(AudioFileWriter.java:314) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at org.jaudiotagger.audio.AudioFileIO.writeFile(AudioFileIO.java:336) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at org.jaudiotagger.audio.AudioFileIO.write(AudioFileIO.java:165) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at com.kanedias.vanilla.audiotag.PluginService.persistChanges(PluginService.java:210) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at com.kanedias.vanilla.audiotag.PluginService.handleP2pIntent(PluginService.java:262) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at com.kanedias.vanilla.audiotag.PluginService.handleLaunchPlugin(PluginService.java:155) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at com.kanedias.vanilla.audiotag.PluginService.onStartCommand(PluginService.java:129) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at android.app.ActivityThread.-wrap21(ActivityThread.java) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at android.os.Handler.dispatchMessage(Handler.java:102) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at android.os.Looper.loop(Looper.java:154) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at android.app.ActivityThread.main(ActivityThread.java:6126) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at java.lang.reflect.Method.invoke(Native Method) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 01-18 10:38:03.590 15619 15619 E Vanilla:TagEditorPlugin: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Kaned1as commented 7 years ago

Wow, did Lineage already got build servers working? Seems like I have missed a lot.

Will take a look at weekend.

motatuc commented 7 years ago

Not so far. There's a need to compile for yourself. :)

About the crash: The music files are on the external SD card. Maybe this makes a difference.

Kaned1as commented 7 years ago

Ok, I'll build up Nougat emu in a day or two and see what's happening

GaloisGhost commented 7 years ago

Same issue on 6.0.1 also writing to SD Card, my feeling is it's to do with storage access framework.

Kaned1as commented 7 years ago

@GaloisGhost , you're right, I'm researching it

The SAF makes it simple for users to browse and open documents, images, and other files across all of their their preferred document storage providers. A standard, easy-to-use UI lets users browse files and access recents in a consistent way across apps and providers.

Oh the irony

Kaned1as commented 7 years ago

Looks like SAF does not express needed interfaces for us to be able to write file tag. It can only provide file descriptor, while we need seek-based file access.

I've tried some hacky ways to workaround this, but unfortunately all my attempts failed. I stored my observations and initial work in saf-struggles branch, so if anyone has more deep knowledge of Android framework, I'd gladly accept related PR.

For now I'll be showing a toast with explanation why file write failed. Sorry.

Kaned1as commented 7 years ago

@GaloisGhost , @motatuc , 1.1.1 version is now on F-Droid, try it