simple-last-fm-scrobbler / sls

Simple Scrobbler, for Android -- last.fm, libre.fm & ListenBrainz
https://simple-last-fm-scrobbler.github.io
Apache License 2.0
550 stars 99 forks source link

Should Resolve Most App Compliance Issues #478

Closed a-r-db closed 5 years ago

a-r-db commented 5 years ago

The newest libraries have been included.

a-r-db commented 5 years ago

This should resolve approximately 90% of users issues. Some users using android devices lower than Lollipop may not have this benefit.

goodevilgenius commented 5 years ago

This is really going to add support for all these apps? That's amazing. I can't wait until the stable release is ready.

a-r-db commented 5 years ago

I could do a release now, although I fear that the bugs will anger users if there are too many. I have sort of whipped up this code in a few days. I need about a week or so to test and confirm the changes are reliable. And thanks, I hope everything works well.

a-r-db commented 5 years ago

Well, it's true some Music Apps might be too deprecated and not using the newest MediaSession tools.

There will simply be a few apps I cannot get information from, so closing is ok for now.

HERE is a signed APK #479 for testing and debugging.

goodevilgenius commented 5 years ago

Pre-release seems to never actually send scrobbles.

Now Playing is updated (and shows up on the sites). Songs get added to cache, but never show up on the various sites. I have last.fm, libre.fm, and ListenBrainz, and all are doing this.

Within the app, all songs are listed in the cache, but clicking "Scrobble Now" does nothing.

This seems to happen with all apps, even previously fully-supported apps. I checked with Pandora and Google Play Music (which has always worked fine).

a-r-db commented 5 years ago

This is a new thing or it's been doing this before the new update? And thanks by the way. I haven't had a lot of feedback.

a-r-db commented 5 years ago

Could you please share the following: Android version? Phone model? Are your credentials filled?

goodevilgenius commented 5 years ago

This is a new thing. On v1.5.7, scrobbling worked fine. Sometimes they would get stuck in the cache until I opened the app, but then they would immediately scrobble.

Now, on v1.5.8-pre-v3, songs are put in the cache, and never actually scrobbled. Even when I click "Scrobble now", nothing happens.

This is on a Samsung Galaxy S10E running Android 9.

goodevilgenius commented 5 years ago

And glad to help testing the new version. I'm really excited for this update. It looks really promising once the kinks are ironed out.

a-r-db commented 5 years ago

All three services are stuck in the cache? last, libre & listen? And are your power settings set that way? after 5 songs for example.

a-r-db commented 5 years ago

I can't seem to recreate your database problem ...

a-r-db commented 5 years ago

Was your install an upgrade as opposed to fresh install?

goodevilgenius commented 5 years ago

Yeah, all three services. Yes, it was an upgrade. When I upgraded, though, all my data was lost, and I had to re-add my accounts.

a-r-db commented 5 years ago

So the app might have left the remaining songs in the cache from before and it could have caused issues. I will need to do some trial runs on upgrading, to make sure upgrade is not broken.

goodevilgenius commented 5 years ago

@a93h When I upgraded, there weren't any songs in the queue. I opened the app before I upgraded, and checked. The queue was empty.

The songs currently stuck in the queue were new since upgrading.

goodevilgenius commented 5 years ago

I'll try wiping data, and uninstalling and reinstalling shortly and let you know if that fixes the scrobbling problem.

goodevilgenius commented 5 years ago

Since clearing data, and then un- and re-installing, I've now got an odder issue.

When I started the app, there was already one scrobble in my cache. It was from a few days ago, although that was previously scrobbled.

When I click "Scrobble Now", the app crashes.

a-r-db commented 5 years ago

This is great information, you don't by chance have adb handy?

goodevilgenius commented 5 years ago

I've got adb installed on all my computers.

a-r-db commented 5 years ago

Well if you know how to recreate those bugs and send me whatever comes out of adb while the app crashes I can patch the bug or restructure.

a-r-db commented 5 years ago

@goodevilgenius I am having a hard time recreating the app upgrade bug, let me know if you catch the log data for it.

a-r-db commented 5 years ago

Good News! I resolved the upgrade issues. I managed to get the same problems you had and found out it was an issue with the upgrade code.

Bad News! I kind of expected something gnarly would happen like this if I did not read the code fully before implementing custom database methods.

485

goodevilgenius commented 5 years ago

What exactly do I need to do with adb? You need a logcat?

I've never actually done any Android development. I just use adb for backing up my phone, and for web development (connecting to Dev Tools from my computer).


I tried installing v1.5.8-pre-v5 and definitely saw some odd behavior.

It didn't fix the scrobbling bug.

Additionally, I tried clearing app data, uninstalling and reinstalling (instead of upgrading), and when I started the app again, my account logins were already there, and there were a few tracks in the queue, although not all of them that were there from before the upgrade.

And attempting to "Scrobble Now" still crashes the app.

a-r-db commented 5 years ago

Ok, I thought it was for sure the problem.

a-r-db commented 5 years ago

I built a wiki page for this.

https://github.com/simple-last-fm-scrobbler/sls/wiki/Debugging-Crashes

a-r-db commented 5 years ago

I think I found it...

2019-08-28 15:11:26.534 1932-1999/com.adam.aslfms E/SQLiteLog: (1) foreign key mismatch - "scrobbles_netapp" referencing "scrobbles_netapp"
2019-08-28 15:11:26.537 1932-1999/com.adam.aslfms E/AndroidRuntime: FATAL EXCEPTION: pool-6-thread-1
    Process: com.adam.aslfms, PID: 1932
    android.database.sqlite.SQLiteException: foreign key mismatch - "scrobbles_netapp" referencing "scrobbles_netapp" (code 1 SQLITE_ERROR[1]): , while compiling: DELETE FROM scrobbles_netapp WHERE netappid = ? and trackid = ?
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1229)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:703)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
        at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:2047)
        at com.adam.aslfms.util.ScrobblesDatabase.deleteScrobble(ScrobblesDatabase.java:257)
        at com.adam.aslfms.service.Scrobbler.doRun(Scrobbler.java:111)
        at com.adam.aslfms.service.AbstractSubmitter.run(AbstractSubmitter.java:67)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)