Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Add song to playlist problem #100

Closed
Zaxx69 opened this issue Jul 26, 2023 · 9 comments
Closed

[Bug] Add song to playlist problem #100

Zaxx69 opened this issue Jul 26, 2023 · 9 comments

Comments

@Zaxx69
Copy link

Zaxx69 commented Jul 26, 2023

Whenever i want to add a song to my playlist, it generates this text
java.lang.NullPointerException
at com.toasterofbread.spmp.api.AccountPlaylistsKt.editAccountPlaylist(Unknown Source:63)
at com.toasterofbread.spmp.model.mediaitem.AccountPlaylist.saveItems-IoAF18A(Unknown Source:74)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1.invokeSuspend(Unknown Source:69)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1.invoke(Unknown Source:8)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1.invoke(Unknown Source:4)
at com.toasterofbread.spmp.ui.component.longpressmenu.LongPressMenuData$Actions$1$1$1.invokeSuspend(Unknown Source:63)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
at kotlinx.coroutines.DispatchedTask.run(Unknown Source:100)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at android.app.ActivityThread.main(ActivityThread.java:8374)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Suppressed: coil.network.HttpException: [StandaloneCoroutine{Cancelling}@e0984b0, Dispatchers.Main]

@toasterofbread
Copy link
Owner

Seems like this might be related to #84

A few questions:

  • Does it happen every time?
  • Does it only happen with one playlist, or a specific few playlists rather than all playlists?

If so,

  • Is the playlist owned by the YouTube account you're signed in with?
  • Are there any items already in the playlist?
  • Did you make the playlist in SpMp or on YouTube?

It would be helpful if you could share the URL of a playlist that this happens with.

@Zaxx69
Copy link
Author

Zaxx69 commented Jul 29, 2023

  1. Yes it happens every time but when i do it for a second time, it adds the song to the playlist. For example, let's say i wanted to add crystal song to my playlist, upon clicking on add to playlist, this error pops up. But when i do it for a second time it adds the song. Now if i want to add land of fire as my second song, the error agains pops up but upon clicking add to playlist again it adds the song. Hope you understand, it will appreciated if you would open a telegram channel for discussion because we can't send video here
  2. I have only one playlist

@Subbarao6338
Copy link

For me also same problem.
I have multiple playlists in my YouTube.
For every song I have faced the problem.
Please fix this problem.

@toasterofbread
Copy link
Owner

For me also same problem. I have multiple playlists in my YouTube. For every song I have faced the problem. Please fix this problem.

Are you using v0.2.0? If so please upload the stacktrace from the error, as the functions in the original one don't even exist anymore.

@Subbarao6338
Copy link

android.database.sqlite.SQLiteException: no such function: IIF (code 1 SQLITE_ERROR): , while compiling: SELECT COUNT(IIF(PlaylistItem.playlist_id = ?, 1, NULL)) FROM PlaylistItem
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:986)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:593)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:61)
at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1443)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1418)
at app.cash.sqldelight.driver.android.AndroidQuery.executeQuery(Unknown Source:30)
at mediaitem.MediaItemQueries$titleById$1.invoke(SourceFile:39)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver.execute-zeHU3Mk(Unknown Source:26)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver.executeQuery(Unknown Source:22)
at mediaitem.PlaylistItemQueries$ItemCountQuery.execute(Unknown Source:31)
at app.cash.sqldelight.Query.executeAsOneOrNull(Unknown Source:6)
at app.cash.sqldelight.Query.executeAsOne(Unknown Source:0)
at com.toasterofbread.spmp.model.mediaitem.playlist.Playlist$Items$3.invoke(SourceFile:2)
at com.toasterofbread.spmp.model.mediaitem.playlist.Playlist$Items$3.invoke(SourceFile:3)
at com.toasterofbread.spmp.model.mediaitem.PropertyRememberer$rememberListQueryProperty$1$3.invoke(SourceFile:1)
at com.toasterofbread.spmp.model.mediaitem.PropertyRememberer$rememberListQueryProperty$1$3.invoke(SourceFile:2)
at com.toasterofbread.spmp.model.mediaitem.db.ListPropertyImpl$addItem$1$1.invoke(SourceFile:2)
at com.toasterofbread.spmp.model.mediaitem.db.ListPropertyImpl$addItem$1$1.invoke(SourceFile:1)
at app.cash.sqldelight.TransacterImpl.transactionWithWrapper(Unknown Source:52)
at okio._UtilKt.transaction$default(Unknown Source:6)
at com.toasterofbread.spmp.model.mediaitem.db.ListPropertyImpl.addItem(Unknown Source:42)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1$1.invoke(SourceFile:3)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1$1.invoke(SourceFile:1)
at app.cash.sqldelight.TransacterImpl.transactionWithWrapper(Unknown Source:52)
at okio._UtilKt.transaction$default(Unknown Source:6)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1.invokeSuspend(Unknown Source:30)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1.invoke(SourceFile:1)
at com.toasterofbread.spmp.ui.component.mediaitempreview.SongPreviewKt$SongLongPressMenuActions$1$5$1$3$1$1.invoke(SourceFile:2)
at com.toasterofbread.spmp.ui.component.longpressmenu.LongPressMenuData$Actions$1$1$1.invokeSuspend(Unknown Source:64)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
at kotlinx.coroutines.DispatchedTask.run(Unknown Source:102)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7592)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Suppressed: coil.network.HttpException: [StandaloneCoroutine{Cancelling}@986a402, Dispatchers.Main]

@toasterofbread
Copy link
Owner

Seems like the IIF function isn't available on Android versions 11 and below (no idea why SQLITE version is tied to the OS version). I'll replace it with a compatible call.

@Subbarao6338
Copy link

android.database.sqlite.SQLiteException: no such function: IIF (code 1 SQLITE_ERROR): , while compiling: SELECT COUNT(IIF(PlaylistItem.playlist_id = ?, 1, NULL)) FROM PlaylistItem
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:986)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:593)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:61)
at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1443)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1418)
at app.cash.sqldelight.driver.android.AndroidQuery.executeQuery(Unknown Source:30)
at mediaitem.MediaItemQueries$titleById$1.invoke(SourceFile:39)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver.execute-zeHU3Mk(Unknown Source:26)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver.executeQuery(Unknown Source:22)
at mediaitem.PlaylistItemQueries$ItemCountQuery.execute(Unknown Source:31)
at app.cash.sqldelight.Query.executeAsOneOrNull(Unknown Source:6)
at app.cash.sqldelight.Query.executeAsOne(Unknown Source:0)
at com.toasterofbread.spmp.model.mediaitem.playlist.Playlist$Items$3.invoke(SourceFile:2)
at com.toasterofbread.spmp.model.mediaitem.playlist.Playlist$Items$3.invoke(SourceFile:3)
at com.toasterofbread.spmp.model.mediaitem.PropertyRememberer$rememberListQueryProperty$1$3.invoke(SourceFile:1)
at com.toasterofbread.spmp.model.mediaitem.PropertyRememberer$rememberListQueryProperty$1$3.invoke(SourceFile:2)
at com.toasterofbread.spmp.model.mediaitem.db.ListPropertyImpl$addItem$1$1.invoke(SourceFile:2)
at com.toasterofbread.spmp.model.mediaitem.db.ListPropertyImpl$addItem$1$1.invoke(SourceFile:1)
at app.cash.sqldelight.TransacterImpl.transactionWithWrapper(Unknown Source:52)
at okio._UtilKt.transaction$default(Unknown Source:6)
at com.toasterofbread.spmp.model.mediaitem.db.ListPropertyImpl.addItem(Unknown Source:42)
at com.toasterofbread.spmp.youtubeapi.impl.youtubemusic.endpoint.AccountPlaylistEditor.performActionOrGetRequestData(Unknown Source:143)
at com.toasterofbread.spmp.youtubeapi.impl.youtubemusic.endpoint.AccountPlaylistEditor.access$performActionOrGetRequestData(Unknown Source:0)
at com.toasterofbread.spmp.youtubeapi.impl.youtubemusic.endpoint.AccountPlaylistEditor$performAndCommitActions$3.invokeSuspend(Unknown Source:73)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
at kotlinx.coroutines.DispatchedTask.run(Unknown Source:102)
at kotlinx.coroutines.internal.LimitedDispatcher.run(Unknown Source:12)
at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:76)
Suppressed: coil.network.HttpException: [androidx.compose.ui.platform.MotionDurationScaleImpl@6e253d4, androidx.compose.runtime.BroadcastFrameClock@de0797d, StandaloneCoroutine{Cancelling}@1460072, AndroidUiDispatcher@91d1cc3]

@Subbarao6338
Copy link

Still not working

@toasterofbread
Copy link
Owner

Are you sure you're using the right build (3624436 or later)? The IIF function mentioned in the stacktrace doesn't exist in the source code anymore. You might have to clear the app's data to rebuild the database but I doubt that's the issue.

toasterofbread added a commit that referenced this issue Nov 12, 2023
Fix crash when adding item to playlist on older Android versions (closes #100)
Fix playlist item add not working from long press menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants